Skip to content

Conversation

paulw11
Copy link

@paulw11 paulw11 commented Apr 6, 2020

The current code doesn't check to see if the supplied access token is expired.
This adds a check for the exp field of the JWT

try:
user = backend.do_auth(access_token=request.token)
user_data = backend.user_data(access_token=request.token)
exp = user_data['exp']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the value exp holds?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exp is the expiration date of the token

user = backend.do_auth(access_token=request.token)
user_data = backend.user_data(access_token=request.token)
exp = user_data['exp']
if not exp and exp <= datetime.now():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The not operator having higher precedence makes this always evaluate to False whenever exp evaluates to True. Can you please explain the desired operation here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants