jetbridge / flask_cognito

Flask authentication with JWT against AWS Cognito
MIT License
94 stars 30 forks source link

Request for a tutorial/updated readme #18

Closed kashyapm94 closed 3 years ago

kashyapm94 commented 3 years ago

Hey, I came across flask_cognito and it seems like a really interesting and good project.

But, as a beginner, it is a bit complicated to understand how this package should be used.

For example: In the readme there is information about initialization with the following code:

@cogauth.identity_handler
def lookup_cognito_user(payload):
    """Look up user in our database from Cognito JWT payload."""
    return User.query.filter(User.cognito_username == payload['username']).one_or_none()

Here, it is really confusing and difficult to understand from where the User comes into play and also what the payload is. I am assuming it is a basic user model (as shown in this tutorial: https://realpython.com/token-based-authentication-with-flask/).

So, it would be great if you can update the readme to include kind of a step-by-step walkthrough.

If there is already an existing tutorial for this, could you please point me to it?

Thanks & Cheers!

revmischa commented 3 years ago

I suggest taking a look at https://pythonhosted.org/Flask-JWT/#flask_jwt.JWT.identity_handler If you can update the docs that'd be awesome! Once it's clearer in your mind