# Intermittent Invalid State

**URL:** <https://community.auth0.com/t/intermittent-invalid-state/69452>\
**Category:** Get Help\
**Tags:** auth0-spa-js\
**Created:** [September 10, 2021, 6:39pm UTC](https://community.auth0.com/t/intermittent-invalid-state/69452 "2021-09-10T18:39:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elamison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/elamison/32/14596_2.png) [@elamison](https://community.auth0.com/u/elamison)\
**Post date:** [September 10, 2021, 6:39pm UTC](https://community.auth0.com/t/intermittent-invalid-state/69452/1 "2021-09-10T18:39:02Z")

</div>

auth0-spa-js  
1.81  
React

We’re using the auth0-spa-js module and for some (3) users after they login they get an Invalid State error. If they then go to the protected page they are authenticated and it works. The specific part that fails is in Auth0Client.ts:

```auto
    if (!transaction || !transaction.code_verifier) {
      throw new Error('Invalid state');
    }

```

Nobody else can reproduce it. One person on a Mac with Chrome, another on Windows and Edge and one on Windows and Chrome. Any ideas? I’m using almost the exact react example.

---

<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:** [September 14, 2021, 5:30pm UTC](https://community.auth0.com/t/intermittent-invalid-state/69452/3 "2021-09-14T17:30:48Z")

</div>

Hi @elamison,

Welcome back!

Are you using an up-to-date version of auth0-spa-js? There isn’t a version 1.81 at the moment.

Can you provide a link to the example you are using?

An invalid state error can occur when the state param from the original request does not match the state parameter in the response. This can be caused by multiple requests happening simultaneously/back-to-back.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 23, 2021, 4:56pm UTC](https://community.auth0.com/t/intermittent-invalid-state/69452/4 "2021-12-23T16:56:05Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
