Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What's the difference between flask jwt and flask-jwt extended?


Asked by Cruz Cruz on Dec 06, 2021 FAQ



Flask-JWT-Extended is very similar to Flask-JWT, but has more configuration options and some more functionality. For example, it allows for token refreshing. After you're comfortable with Flask-JWT—and if you need those advanced features—read our blog post on Flask-JWT-Extended for more!
Next,
Flask-JWT-Extended not only adds support for using JSON Web Tokens (JWT) to Flask for protecting views, but also many helpful (and optional) features built in to make working with JSON Web Tokens easier. These include: Support for adding custom claims to JSON Web Tokens.
Subsequently, When authenticating via credentials the first time, we not only return an access token that contains the user's account info—we also return a refresh token that only serves to refresh the access token. When an access token has expired we provide the refresh token, and Flask-JWT-Extended verifies it and returns a new, valid access token.
Moreover,
The user gets authenticated and their info gets encrypted and returned as an access token (JWT). Whenever the user wants to tell us who they are, they send the access token along with their request.
Furthermore,
To secure an endpoint, we use the @jwt_required decorator. An API endpoint is set up at /auth that accepts username and password via JSON payload and returns access_token which is the JSON Web Token we can use.