Flask-JWT-Extended Set Up
To integrate the authentication feature into our website, we will use the Flask-JWT-Extended library. First, let's install it by running the following command:
Code Setup and Configuration
Next, in the app.py file, we import JWTManager from the flask_jwt_extended library:
We then add another configuration parameter within our create_app()
function:
Just as we secured our SECRET_KEY in the .env file, we will also hide the JWT key. It's best to use a random set of values for greater security, similar to how we generated the SECRET_KEY.
Initialization
After adding the necessary information to the .env and .env.sample files, we initialize the jwt
variable using the JWTManager
and pass our app
to it:
In the next chapter, we will write an endpoint for user registration.
Takk for tilbakemeldingene dine!
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Awesome!
Completion rate improved to 3.03
Flask-JWT-Extended Set Up
Sveip for å vise menyen
To integrate the authentication feature into our website, we will use the Flask-JWT-Extended library. First, let's install it by running the following command:
Code Setup and Configuration
Next, in the app.py file, we import JWTManager from the flask_jwt_extended library:
We then add another configuration parameter within our create_app()
function:
Just as we secured our SECRET_KEY in the .env file, we will also hide the JWT key. It's best to use a random set of values for greater security, similar to how we generated the SECRET_KEY.
Initialization
After adding the necessary information to the .env and .env.sample files, we initialize the jwt
variable using the JWTManager
and pass our app
to it:
In the next chapter, we will write an endpoint for user registration.
Takk for tilbakemeldingene dine!