Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better username evaluation in get_user_obj #278

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wazy
Copy link

@wazy wazy commented Aug 2, 2024

If Cognito was instantiated with an access token and without a username then get_user will return a user without a username property:

c = Cognito(user_pool, client_id, access_token)
u = c.get_user()
print(u.username) # prints None

This PR allows get_user_obj to check if username is not set and if so try to set it to self.username or the username from the metadata dictionary if it exists.

Order of preference for what username should be:

  1. passed in username
  2. self.username
  3. username from the metadata

@wazy
Copy link
Author

wazy commented Aug 2, 2024

@ludeeus @pvizeli This is a bug I believe and this change should address it. Should I start opening issues to link to in PRs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant