# Invalid State Error on localhost quickstart deployment

**URL:** <https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122>\
**Category:** Get Help\
**Tags:** login\
**Created:** [November 15, 2021, 3:04am UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122 "2021-11-15T03:04:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaDukyDev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dadukydev/32/33009_2.png) [@DaDukyDev](https://community.auth0.com/u/DaDukyDev)\
**Post date:** [November 15, 2021, 3:04am UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/1 "2021-11-15T03:04:29Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 15, 2021, 9:44am UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/2 "2021-11-15T09:44:29Z")

</div>

Hey there!

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

> **[GitHub - auth0-samples/auth0-php-web-app: Auth0 Integration Samples for PHP...](https://github.com/auth0-samples/auth0-php-web-app)**
>
> Auth0 Integration Samples for PHP Web Applications - GitHub - auth0-samples/auth0-php-web-app: Auth0 Integration Samples for PHP Web Applications

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

---

<div class="post-metadata">

**Author:** ![DaDukyDev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dadukydev/32/33009_2.png) [@DaDukyDev](https://community.auth0.com/u/DaDukyDev)\
**Post date:** [November 15, 2021, 10:07am UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/3 "2021-11-15T10:07:17Z")

</div>

Hey there, I’ve raised the issue at

> <https://github.com/auth0-samples/auth0-php-web-app/issues/73>
>
> Hey there,
> this is a problem I think others have been facing, but I couldn’t fi…nd 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. I've followed the guide carefully, as this is just to familiarise myself with the platform's functions.
> If anyone has any answers, that would be great.
> Thanks, Tim

Thanks, Tim

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 15, 2021, 10:13am UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/4 "2021-11-15T10:13:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dhi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dhi/32/12767_2.png) [@dhi](https://community.auth0.com/u/dhi)\
**Post date:** [November 20, 2021, 8:38pm UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/5 "2021-11-20T20:38:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DaDukyDev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dadukydev/32/33009_2.png) [@DaDukyDev](https://community.auth0.com/u/DaDukyDev)\
**Post date:** [November 21, 2021, 10:53pm UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/6 "2021-11-21T22:53:30Z")

</div>

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?  
Tim

---

<div class="post-metadata">

**Author:** ![dhi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dhi/32/12767_2.png) [@dhi](https://community.auth0.com/u/dhi)\
**Post date:** [November 21, 2021, 11:03pm UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/7 "2021-11-21T23:03:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 22, 2021, 10:52am UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/8 "2021-11-22T10:52:08Z")

</div>

Thank you everyone for sharing all this context!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 25, 2021, 10:25am UTC](https://community.auth0.com/t/invalid-state-error-on-localhost-quickstart-deployment/73122/9 "2021-11-25T10:25:19Z")

</div>


