NabuCasa / pycognito

Python library for using AWS Cognito. With support for SRP.
Apache License 2.0
129 stars 39 forks source link

[#66] Allow admin_create_user to let Cognito create a temporary password #169

Closed nk9 closed 1 year ago

nk9 commented 1 year ago

This addresses #66 by only adding TemporaryPassword conditionally to additional_kwargs. I've verified that Cognito is now successfully creating the user, and also generating a compliant password when admin_create_user is called with no temporary_password parameter, and also when temporary_password is None.

Two details:

  1. If the user happened to pass both TemporaryPassword in the additional_kwargs dictionary and also the temporary_password parameter, then this value would be overridden. However, I'm not sure what a user would expect to happen in that case. It seems reasonable to coalesce the values, and we have to choose one of them anyway.
  2. The user can also pass an empty string, since that's falsy in Python. Indeed, I've left the default argument value alone for this reason.
nk9 commented 1 year ago

Released in 2022.11.0