Invalid State Error on localhost quickstart deployment

Hey there,
this is a problem I think others have been facing, but I couldn’t find a conclusive answer. I am using the quick-start php project, and whenever I log in, I get the following PHP error on /callback

Fatal error: Uncaught Auth0\SDK\Exception\StateException: Invalid state in /Users/timothytownsend/Desktop/auth0/vendor/auth0/auth0-php/src/Exception/StateException.php:24 Stack trace: #0 /Users/timothytownsend/Desktop/auth0/vendor/auth0/auth0-php/src/Auth0.php(323): Auth0\SDK\Exception\StateException::invalidState() #1 /Users/timothytownsend/Desktop/auth0/index.php(52): Auth0\SDK\Auth0->exchange('http://127.0.0....') #2 [internal function]: {closure}() #3 /Users/timothytownsend/Desktop/auth0/vendor/steampixel/simple-php-router/src/Steampixel/Route.php(103): call_user_func_array(Object(Closure), Array) #4 /Users/timothytownsend/Desktop/auth0/index.php(64): Steampixel\Route::run('') #5 {main} thrown in /Users/timothytownsend/Desktop/auth0/vendor/auth0/auth0-php/src/Exception/StateException.php on line 24

Everything looks to be installed correctly, so I am not sure why it won’t work.
If anyone has any answers, that would be great.
Thanks, Tim

Hey there!

Can I ask you to raise it as a GitHub issue in the quickstart repo:

so we can address that directly with maintainers? Once you have a link to it you can share it here so we can ping them

Hey there, I’ve raised the issue at

Thanks, Tim

1 Like

Thank you! I’ll ping repo maintainers in a minute!

I’m experiencing this same issue with the PHP SDK, I am new to Auth0, but basically same issue as outlined in the thread. Is there any update with regards to why this is happening? Oddly I don’t get this locally, only when deployed to an online host etc… i’ve tried a few.

Hey dhi,
I am not sure what you’ve done here, but maybe check your application’s allowed callback URLs, they may be the source of the error?

1 Like

My issue was due to Nginx, when disabled on the remote server the exchange worked no problem as it did locally where I wasn’t using Nginx. This however is not ideal disabling Nginx. I spent way to much time on this would be good to understand if this in-fact is a known issue with Auth0 and the php-sdk?

Thank you everyone for sharing all this context!