Skip to content Skip to sidebar Skip to footer

Token Based Authentication In Flask

I am trying to create token for logged in user for a particular duration and using g.user to keep track of current user. generate_auth_token and verify_auth_token belong to class

Solution 1:

You need an Object-Document-Mapper for your User class.

Try this

  • Use MongoEngine as your ODM. (There are other options like MongoFrames)

Here is a working example using MongoEngine as the ODM https://github.com/timosville/rest_auth_mongodb

Solution 2:

define generate_auth_token method inside the User class

Post a Comment for "Token Based Authentication In Flask"