Ishan
Ishan

Reputation: 11

Tried logging to auth0 i got invalid state error

I have a problem with auth0.

There are two auth0 Applications in the project that I am working on right now. One is in PHP other one is WordPress. Both use auth0 Hosted Page.

First I opened my WordPress site in a tab in my web browser. Then I opened the same in another tab. Then tried logging in from the first tab by entering the email and the password and got the below error message:

wordpress error msg "There was a problem with your log in: Invalid state [error code: unknown]"

If it is a PHP site got the below error message:

php error msg "Fatal error: Uncaught Auth0\SDK\Exception\CoreException: Invalid state in C:\xampp\htdocs\uat.sso\sso\vendor\auth0\auth0-php\src\Auth0.php:511 Stack trace: #0 C:\xampp\htdocs\uat.sso\sso\vendor\auth0\auth0-php\src\Auth0.php(434): Auth0\SDK\Auth0->exchange() #1 C:\xampp\htdocs\uat.sso\sso\callback.php(8): Auth0\SDK\Auth0->getUser() #2 {main} thrown in C:\xampp\htdocs\uat.sso\sso\vendor\auth0\auth0-php\src\Auth0.php on line 511"

Upvotes: 1

Views: 1933

Answers (1)

Shayan
Shayan

Reputation: 700

Auth0 have a comprehensive guide on dealing with Invalid State errors in WordPress. You can check it out here.

Basically the most common causes are:

  • Cached Auth0 Callback URL, some hosting provider do this by default and they should be contacted to not cache this.
  • Cached Cookies and URL parameters
  • Cookie name requirements for certain hosting providers like Pantheon.

See the complete list here.

Upvotes: 0

Related Questions