question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) using refresh token

See original GitHub issue

I am running into the error: oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

My token settings are:

{
 "token_type": "Bearer",
...
 "expires_in": 3600,
 "ext_expires_in": 3600,
 "access_token": "xxx",
 "refresh_token": "xxx",
 "expires_at": 1561845080.052145
}

Now: 2019-06-30 14:09:04 Expires at: 2019-06-29 21:51:20 (1561845080.052145)

According to the datetimes above, the token is considered to be expired, yet its is_expired property returns False. For some reason, property expiration_datetime is adding 90 days to the expires_at attribute, if refresh_token attribute is present. This does not seem correct and is causing the token expired error.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
codectlcommented, Jul 1, 2019

Hi @janscas

Thanks a lot for the answer. You are right. After looking at it again, I captured the logic you mentioned. I have to investigate it further to trace where is the refresh token process failing.

0reactions
janscascommented, Jul 1, 2019

Hopefully it is considered in the next version.

It will! Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

oauthlib.oauth2.rfc6749.errors.TokenExpiredError #35 - GitHub
rfc6749.errors.TokenExpiredError is being thrown in case the access token received is expired which causes an internal server error to be shown.
Read more >
How to use the oauthlib.oauth2.rfc6749.errors.OAuth2Error ...
# "id_token token" - return the access token and the id token # "id_token" - don't return the access token if "token" in...
Read more >
Flask-Dance and TokenExpiredError - python - Stack Overflow
How do you code around this error: oauthlib.oauth2.rfc6749.errors.TokenExpiredError. I spent a while trying to do a try/except block but no ...
Read more >
Refreshing tokens in OAuth 2 - Requests-OAuthlib
This example shows how a simple web application (using the Flask web framework) can refresh Google OAuth 2 tokens. It should be trivial...
Read more >
oauthlib.oauth2.rfc6749.errors.InvalidTokenError Example
. The Access Token obtained from an OpenID Connect Authentication Request MUST be sent as a Bearer Token, ;. It is RECOMMENDED that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found