# Auth0 PHP SDK: Invalid state

**URL:** <https://community.auth0.com/t/auth0-php-sdk-invalid-state/85200>\
**Category:** Get Help\
**Tags:** state, callback, auth0\
**Created:** [June 15, 2022, 10:53pm UTC](https://community.auth0.com/t/auth0-php-sdk-invalid-state/85200 "2022-06-15T22:53:42Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 30, 2024, 3:49pm UTC](https://community.auth0.com/t/auth0-php-sdk-invalid-state/85200/10 "2024-01-30T15:49:36Z")

</div>

Hey all,

If you’re seeing the invalid state error, it’s generally because the state param in the application does not match the state param returned by Auth0 after the authentication.

This is typically the result of 2 authentication transactions running back to back, which creates two state params and results in a “mismatch” between the param in the response and the one expected in the application.

There’s a good thread about it here:

> [@PHP SDK 8 - Invalid State After SignUp Redirect](https://community.auth0.com/t/php-sdk-8-invalid-state-after-signup-redirect/80550/2):
>
> Hi @paulrileydnrg wave An InvalidState exception is [thrown from the PHP SDK](https://github.com/auth0/auth0-PHP/blob/main/src/Auth0.php#L322) during exchange() when the state parameter returned by Auth0 doesn’t match the temporary cookie stored on the client when login() is fired before the redirect. This means there is either an issue with the cookie getting stored properly on the client before getting redirected, being retrieved from the client during callback, or an issue with pulling the state response from the callback request. Check your Auth0 logs …

---

_[View the full topic](https://community.auth0.com/t/auth0-php-sdk-invalid-state/85200)._
