Refresh functionality with auth0-spa-js

I have my ReactJs app set up to use auth0-spa-js. However, I need to add the ability to extend (or refresh) the session in order to achieve a scenario where the user can log in once and open up a dashboard, which can stay on indefinitely.

Can you recommend the best way to achieve this? Is it possible through auth0-spa-js or would I have to switch to auth0-js?

What you’re looking for is silent authentication. Or, with the auth0-spa-js, you’d use getTokenSilently.

Also, have a look at the React Quickstart.

You can also search this forum for these terms, it’s been asked a lot before.

2 Likes

Thanks Mathias! I was actually following that same QuickStart, which was very helpful. It looks like I was already using getTokenSilently, but didn’t know it would let me stay authorized indefinitely.

1 Like

Glad you have it working @JMLert!