React SPA Page Refresh Triggers Failed Silent Auth On Reload

I have been searching through the community posts and have been unable to find a solution to my problem.

During my SPA development in React, I start my development server with yarn start and upon initial page load I am able to log into the application fine. However, when I go and make a modification to the codebase, the yarn server causes the page to reload and this reload takes generally > 1 minute or even more.

I found a page with a somewhat similar topic, Silent Authentication: ‘does not have a registered origin’, and I followed the directions on the page, ensuring that my Callback URL and Allowed Web Origins are http://localhost:3000/, and http://localhost:3000, respectively. However, this does not seem to fix the issue on page reload.

I additionally found this page, Login lost every time browser is reloaded. This page mentions taking advantage of getTokenSilently() however from my understanding, as long as I am using the recent react_auth_spa.js file, this functionality should be handled for me, so I guess I am not understanding it correctly.

I have instantiated the AuthProvider exactly how the React tutorial mentions:

<Auth0Provider
        domain={config.domain}
        client_id={config.clientId}
        redirect_uri={window.location.origin}
        onRedirectCallback={onRedirectCallback}
        responseType={'id_token token'}
    >
      <App />
</Auth0Provider>

Yet, for whatever reason, again on page load done either manually or with code update the page takes forever to reload, citing the issue in the title. Can anyone please assist?

1 Like

To anyone who ends up on this page by chance, please double check your Client ID. For whatever reason, when I was following the tutorial, the client ID provided in the tutorial was different than my actual application. I thought that the tutorial pulled in the client ID of an existing application but I could be totally wrong. Regardless, using a local user and updating my client ID in my auth_config.json file fixed the refresh issue.

1 Like

Thanks a lot for sharing that with the rest of community!

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