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.

Refreshed Token doesn't work

See original GitHub issue

Hi,

I have an issue with the refreshed token.

Explanations :

My app is on my dedicated server, run with wsgi and is served by nginx through my domain name. In my app.py I log to O365 like this : token_backend = FileSystemTokenBackend(token_path='./', token_filename='o365_token.txt') account = Account(o365_credentials, token_backend=token_backend)

Before using my app, I collected a auth token with another script “auth.py” that I launched to follow the auth process (visit the URL and paste back the new auth URL). Here is my code in “auth.py”: client_id = "PRIVATE" client_secret = "PRIVATE" credentials = (client_id, client_secret) token_backend = FileSystemTokenBackend(token_path='./', token_filename='o365_token.txt') account = Account(credentials, token_backend=token_backend) token = account.authenticate(scopes=['offline_access', 'Calendars.Read', 'Calendars.Read.Shared', 'Calendars.ReadWrite', 'Calendars.ReadWrite.Shared'])

When I follow the auth step, I see that a file called “o365_token.txt” appears and when I read it I see there is a “refresh token” line. However, the token expires after 60minutes and after that I can’t use the API. I can’t figure out why…

Thanks for helping. I tried a lot of differents things to get a refreshed token, without success.

Seevoid

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
seevoidcommented, Oct 2, 2019

OK everything works well now, I can refresh the token properly. This cause was because I created my previous app under a school organization in Azure so I didn’t have the good permissions…

Thanks a lot for your help 😃

1reaction
seevoidcommented, Oct 2, 2019

OK thanks for your support. I tried with thoses scopes : [‘basic’, ‘calendar_all’]

I’ll try to use the API in one hour to check if it’s ok. I’ll give you my feedback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refresh token not working. - Constant Contact Community
The two most common reasons for expired refresh token errors are: 1) When you refresh, you get both a new access token and...
Read more >
Oauth/token not returning refresh token - Auth0 Community
My 3rd Party application has the Refresh Token grant and is OIDC Conforment turned on. The API it is accessing as the audience...
Read more >
Not receiving Google OAuth refresh token - Stack Overflow
My solution was a bit weird..i tried every solution i found on internet and nothing. Surprisely this worked: delete the credentials.json, refresh, vinculate ......
Read more >
Refresh token doesn't work · Issue #739 · doorkeeper-gem ...
Every request to refresh a token results in a {"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired ...
Read more >
OAuth 2.0 with user context: Refresh tokens not working
Without a valid refresh token, there is no way to obtain any new user access tokens, rendering any app using the offline.access scope...
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