auth0 / docs

Auth0 documentation
MIT License
367 stars 1.6k forks source link

Refreshing React SPA browser window, loses existing authenticated state from useAuth(). Can you show example of retaining the state? #10414

Open inspiraller opened 1 month ago

inspiraller commented 1 month ago

When loading the react SPA, currently I have to run getAccessTokenSilently() on a poll of a few seconds to constantly check when an accessToken is available again. I also have to do this when refreshing the browser window. I lose all my authenticated state from the useAuth() hook. This is not an ideal solution. Having read about refresh tokens rotation I was wondering if the auth0 handles this internally automatically or whether I need to implement a strategy to retrieve the refresh-token and ultimately authenticated state. Either way, an example would be useful on the quickstart.