Need to log back in after hiting F5

Hello to you!
I’m building a React JSX application with a C# Backed API.

I’ve implemented the login process, as a state in the “Getting stared” Tutorial, the Login works fine, I’m also getting an AccessToken for Calls to the API. That work fine

But when a refresh the page with F5, the authentication state is kind of lost and I need to click the login button again. that kind of annoying. And I can’t find anyway to silently log back, or to persist the log state.

My App is wrapped with the <Auth0Provider> with good config.
I’m using the isAuthenticated from const { isAuthenticated, getAccessTokenSilently } = useAuth0();

To check if a need to show a LoginButton or a LogoutButton

But when I refresh the page, the flag isAuthenticated turn back to false

Can someone help me with that?

Thanks

Hugo Dufort

Finally GitHub co-pilot , helped me wioth that.

he told me to add cacheLocation="localstorage" to the Auth0Provider componant
like this.

 <Auth0Provider
      domain="*****************"
      clientId="****************"
->      cacheLocation="localstorage"
      authorizationParams={{
        redirect_uri: window.location.origin,
      }}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.