Auth0 Home Blog Docs

Unhandled Rejection (Error): Invalid state in the code sample

I have been checking out the code samples and tried to get the login and logout example working.

When it came to the callback, after login, this error was thrown:
Unhandled Rejection (Error): Invalid state.

Looks like it is falling over on this line: src/react-auth0-spa.js:25

Any ideas?

Hey there @echee!

Sorry for such obvious question to begin but are you sure you have followed the steps in the quickstart thoroughly?

hey no worries, I believe I have.

I set up a new application, and added in the domain and clientId. And added in the urls for the allowed callback, origin etc.

Hi @echee. Thanks for trying our new SDK! Can you try clearing your cookies and try again? We saw this error happen in a few cases when the cookie that manages transactions is full and we can’t add more data to it. There’s a PR to fix this in the next version: But, for now, clearing the cookies and trying again should work. Let me know how it goes.

1 Like

yes! awesome that was it. Thanks for the speedy replies.

No worries! We’re here for you!!!

1 Like

Thanks for the confirmation! This will be fixed in the next version :tada:

1 Like