Closed Paula-Kli closed 2 years ago
Could you tell me what are you gonna use? Something like jwt authentication? https://flask-jwt.readthedocs.io/en/latest/
Could you tell me what are you gonna use? Something like jwt authentication? https://flask-jwt.readthedocs.io/en/latest/
Oh it is German - sorry yes something like this:
def token_required(f):
@wraps(f)
def decorator(*args, **kwargs):
token = None
if 'x-access-tokens' in request.headers:
token = request.headers['x-access-tokens']
if not token:
return jsonify({'message': 'a valid token is missing'})
try:
data = jwt.decode(token, app.config[SECRET_KEY])
current_user = Users.query.filter_by(public_id=data['public_id']).first()
except:
return jsonify({'message': 'token is invalid'})
return f(current_user, *args, **kwargs)
return decorator
without the author... and then the bridge can include the token in the x-access-token
http header...
or do you have a better recommondation on what to do/ use?
I would rather not use Flask-JWT
as it seems not be updated since 2015 (https://pypi.org/project/Flask-JWT/)
I have an idea on how to solve it and will do that tomorrow from here