Followup on transient login in React app


This thread discusses transient login for React app:

But there was no resolution. Currently my react app authenticates fine but if I refresh the page I have to login again.

The app is located here:


Hi @mercicle,

Welcome to the Community!

It looks like you are using auth0 js, which we still support, but we have an improved react sdk that might make things easier.

As far as this app is concerned, it looks like you are missing the code to renew the session if the user is considered authenticated. Check out our old example:

Hi Dan!
Thanks for the react sdk info and the snippet for the Auth.js, when I add componentDidMount() to the app I still get the error

Could not get a new token (login_required: Login required).

Do I have to save the access and id tokens to localStorage with localStorage.setItem() ? do you have an example of how thats done so that the renewSession() uses the local storage?

You shouldn’t save sensitive info to localstorage, including access/id tokens.

Have you tried different browsers? This could be a cookie issue.

I enabled cookies and it still doesn’t work. However, did find out that it works when using email/password vs google login (i.e., I can refresh the page and I’m still logged in). Does this help narrow it down? Thanks!

Which one works, google or email/pass?

email/pass works, but not google, thanks!

Hi Dan any thoughts?