Auth0 Home Blog Docs

Auth0 working on localhost but not online


I have auth0 set up at and while it works on my localhost, when I click on login, it loads another page for a split second and then goes to (not logging in). I’ve console.logged the auth0 function in the online website’s console so you can see what’s going on. Any help would be very appreciated.

Best regards,


when I click on login, it loads another page for a split second

That’s because your user still has an active session at Auth0. Try in a new incognito browser or clear all cookies.

The login and callback seems to work fine (until recently, did you change anything regarding the redirect URI?), I get properly redirected to Auth0 and back, however, your app doesn’t show me as logged in. There’s still some part missing.

That’s still very weird because it should redirect me to

This is my code:

    const initialState = {};
    const store = configureStore(initialState, history);

    const onRedirectCallback = appState => {
        appState && appState.targetUrl
          ? appState.targetUrl
          : window.location.pathname

      <Provider store={store}>
        <ConnectedRouter history={history}>
              <Route path='/about' component={AboutPage} />
              <Route path='/home' component={() => <App />} />
              <Route path='/' component={LandingPage} />

Thanks for the reply @mathiasconradt !

Hey @mathiasconradt, I did a little more research and found out the problem was with my web server. I use AWS Amplify and when it had a bunch of default redirect rules that kicked me back to index.html. I can now navigate to other urls but auth0 still doesnt work. The login pops up and i get redirected to the right path but i don’t get authenticated. Any idea why? Thanks for your help!

The callback with the authorization code works fine in your app, so your client app receives the authorization code correctly (which gets exchanged to an ID and access token).

I assume your client app doesn’t exchange or fetch the code for a token, or doesn’t fetch.
Note that there is also a JS error thrown in the console:

I suggest to take a look at the Quickstarts, and compare the code logic with your own.

Hard to tell without knowing the complete code of your project (can’t tell from the just the onRedirectCallback). Seems to me that your app isn’t asking for the ID token / access token anywhere.