-2

I am creating a login system and using Flask-JWT-Extended in my project. However, when I wanted to create a HS256 secret key to encode my JWT, I couldn't find any proper way to do this. Is there any suitable way to do this in Python, Flask? Thanks in advance.

ned
  • 61
  • 1
  • 5

1 Answers1

0

When you set the configuration options in the flask app

# Example from flask-jwt-extended docs
app = Flask(__name__)

# Setup the Flask-JWT-Extended extension
app.config["JWT_SECRET_KEY"] = "super-secret"  # Change this!
jwt = JWTManager(app)

you can also add the config option JWT_ALGORITHM e.g.

app.config["JWT_ALGORITHM"] = "HS256"

The rest of the basic usage tutorial will show you how to actually create the token.

See docs for this config option and others here

JJ Hassan
  • 395
  • 3
  • 11