Implement basic auth for frontend
This commit is contained in:
15
app/config/jwt_config.py
Normal file
15
app/config/jwt_config.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import os
|
||||
from quart_jwt_extended import JWTManager
|
||||
|
||||
# Initialize JWTManager outside of any function to ensure it's a singleton
|
||||
# It will be initialized with the app object later in server.py
|
||||
jwt = JWTManager()
|
||||
|
||||
def configure_jwt(app):
|
||||
"""Configures JWT settings for the Quart app."""
|
||||
app.config["JWT_SECRET_KEY"] = os.getenv("JWT_SECRET_KEY", "your-super-secret-key-that-should-be-in-env")
|
||||
app.config["JWT_ACCESS_TOKEN_EXPIRES"] = 3600 # 1 hour
|
||||
# You might need to set a custom error handler for unauthorized access
|
||||
# @app.errorhandler(401)
|
||||
# def unauthorized(error):
|
||||
# return jsonify({"msg": "Missing or invalid token"}), 401
|
||||
Reference in New Issue
Block a user