# handleRedirectCallback failing with "Invalid State" error & empty response

**URL:** <https://community.auth0.com/t/handleredirectcallback-failing-with-invalid-state-error-empty-response/86333>\
**Category:** Get Help\
**Created:** [July 3, 2022, 3:34pm UTC](https://community.auth0.com/t/handleredirectcallback-failing-with-invalid-state-error-empty-response/86333 "2022-07-03T15:34:24Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [February 19, 2025, 9:31pm UTC](https://community.auth0.com/t/handleredirectcallback-failing-with-invalid-state-error-empty-response/86333/5 "2025-02-19T21:31:31Z")

</div>

Hi everyone and @SreekarMouli98!

I am sorry about the delayed response to your inquiry!

As @TheMuffinMan has mentioned, this indeed appears to be an issue with the transactionManager which might be deleting the state cookie before the token exchange is completed, resulting in an `Invalid State` error.

I would highly recommend to review this community post regarding the matter where the solution is explained in high details:

> [@Invalid state on reload Auth0 callback url, using auth0-spa-js and Angular 8](https://community.auth0.com/t/invalid-state-on-reload-auth0-callback-url-using-auth0-spa-js-and-angular-8/36469/10):
>
> This issue can be reproduced for different frameworks like React as well. In other words, It isn’t specific to Angular. In summary, before a login transaction starts auth0-spa-js library creates a random state variable and stores it in a cookie. Then, it makes a redirect to Auth0 server with this state parameter. After the user is authenticated Auth0 returns a code along with the same state parameter. Auth-spa-js library checks if the state returned matches with the state stored in the cookie a…

If there are any other questions, feel free to leave a reply!

Kind Regards,  
Nik

---

_[View the full topic](https://community.auth0.com/t/handleredirectcallback-failing-with-invalid-state-error-empty-response/86333)._
