Hi, there is an issue with admin_create_user method, related to temporary_password. Let's assume I'm going to create a new user, and want Cognito generates password for that new user. Currently I am getting an error, because blank string is not allowed, as well as None.
Since I'm not able to make a pull request, I will post possible solution here:
def admin_create_user(self, username, temporary_password=None, attr_map=None, **kwargs):
"""
Create a user using admin super privileges.
:param username: User Pool username
:param temporary_password: The temporary password to give the user.
Leave blank to make Cognito generate a temporary password for the user.
:param attr_map: Attribute map to Cognito's attributes
:param kwargs: Additional User Pool attributes
:return response: Response from Cognito
"""
admin_create_request = {'UserPoolId': self.user_pool_id, 'Username': username,
'UserAttributes': dict_to_cognito(kwargs, attr_map)}
if temporary_password is not None:
admin_create_request['TemporaryPassword'] = temporary_password
response = self.client.admin_create_user(**admin_create_request)
kwargs.update(username=username)
self._set_attributes(response, kwargs)
response.pop('ResponseMetadata')
return response
Hi, there is an issue with admin_create_user method, related to temporary_password. Let's assume I'm going to create a new user, and want Cognito generates password for that new user. Currently I am getting an error, because blank string is not allowed, as well as None.
Since I'm not able to make a pull request, I will post possible solution here: