jetbridge/flask_cognito

Request for a tutorial/updated readme

Closed this issue · 1 comments

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!

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