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.

Describe the problem

I use getTokenSiltently to save access_token in my cookies in order to use it with my API server. I see the networks that the function loginWithRedirect() eventually make a GET to <tenant>/oauth/token. So, I asked for a token twice, when login and when geTokenSilently().

What was the expected behavior?

I need to get the token after loginWithRedirect() finished. Something like: loginWithRedirect().then(token => cookies.set('access_token', token))

Environment

Please provide the following:

  • auth0-react version: 1.2.0
  • Testing in google chrome
  • React
  • react-cookies to save cookies.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
stevehobbsdevcommented, Jan 12, 2021

Anything greater than 60 seconds should work. We have a built-in 60 second leeway where the token will be re-requested before it expires.

1reaction
bernardomichelcommented, Jan 12, 2021

To test it, i set the access_token lifetime to 30seconds. I’ll change it to 1hr and try it again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting the token twice when authenticating for a page
When I am trying to hit on a page which has [AuthGuard] in it, it redirects to login screen (which is perfect) but...
Read more >
When I Try to Get My Access Token Twice I Get the "400 Bad ...
Hi @Andy Belair​ , You can use the generated authorization code only once to get the access and refresh tokens. That is the...
Read more >
Need to run getAuthToken twice before receiving access ...
OAuth2 is started, access to GMail is asked (pop-up) and granted; Console log: token = undefined and Unchecked runtime.lastError while running ...
Read more >
Session Auth issue, requesting Session Token twice after it ...
Hi, I am trying to setup Session Auth and am having some issues. Everything seems to be working locally when it runs but...
Read more >
Users are requested to login twice once their access token is ...
In our application we are redirecting user's to the login page once their access token is expired. At that time the user's are...
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