Add option to choose between id token and access token#44
Open
ckng0221 wants to merge 4 commits intolabd:masterfrom
Open
Add option to choose between id token and access token#44ckng0221 wants to merge 4 commits intolabd:masterfrom
ckng0221 wants to merge 4 commits intolabd:masterfrom
Conversation
The client_id from access token will be validated whether it matches the one defined in the `settings.COGNITO_AUDIENCE`. When using access token, the backend will call the userinfo endpoint from Amazon Cognito, to obtain the user info based on the access key, and pass into the payload inside the Django user_model's get_or_create_for_cognito method.
Split the method into get_user and create_for_cognito. Spliting the method into two allows more efficient calling of the method, especially when using access token. The get_user method will first check whether the user exists. If exists, it will directly skip the get requests from UserInfo endpoint, and also skip the attempt for user creation, and directly return the user object. The UserInfo endpoint will be only called during the initial registeration of the client that does not exist in User database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22
User can define to use id token or access token in
settings.py.Without defining, it by default take id token.