-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json web token/ login #5
base: master
Are you sure you want to change the base?
Conversation
@wraps(f) | ||
def decorated(*args, **kwargs): | ||
token = None | ||
if 'x-access-token' in request.headers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the plain Authorization: Bearer <token>
headers for this? 😄
if 'x-access-token' in request.headers: | ||
token = request.headers['x-access-token'] | ||
if not token: | ||
jsonify({'message': 'Token is missing'}), 401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to jsonify stuff here, just return the dict and the status code!
""" | ||
Generats a Jwt given a username more could be added in the future | ||
""" | ||
token = jwt.encode({'username': username, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rename username
to sub
, and also add the user's name in the name
field.
Fill free to make any observations and i will try to fix them.