Auth0Client.ts:285 Uncaught (in promise) Error: Invalid state

I’m trying to add a login button to our lander page and after login I would like to redirect the user to our react application.

I added to our lander page and added handler on login button click which looks like this:

function() {
        createAuth0Client({
            domain: 'our-domain',
            client_id: 'our-client_id'
        }).then(function(auth0) {
            auth0.loginWithRedirect({
                redirect_uri: 'our-redirect_uri',
            });

        });
    }

After I click a login button I’m redirected to auth0 login page I do log in and then I’m redirected to our react where we are using this react solution (https://github.com/auth0-samples/auth0-react-samples/tree/master/01-Login) and I’m getting this error:

Auth0Client.ts:285 Uncaught (in promise) Error: Invalid state
    at e.<anonymous> (Auth0Client.ts:285)
    at tslib.es6.js:99
    at Object.next (tslib.es6.js:81)
    at tslib.es6.js:73
    at new Promise (<anonymous>)
    at i (tslib.es6.js:69)
    at e.handleRedirectCallback (Auth0Client.ts:268)
    at react-auth0-spa.js:29
    at l (runtime.js:45)
    at Generator._invoke (runtime.js:271)

Can please someone help me solve this issue. Tnx.

Hey there!

In order to handle that most effectively by working directly with the tool maintainers can I ask you to open a GitHub issue for that and then share the link to it here so we can ping them and have them look at it? Thank you!

Github issue: Auth0Client.ts:285 Uncaught (in promise) Error: Invalid state · Issue #189 · auth0-samples/auth0-react-samples · GitHub

1 Like

Perfect thanks! I just pinged repo maintainers!

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