`state mismatch, expected` error thrown from callback in @auth0/nextjs-auth0

I get this error when logging into my application.

Endpoint:
https://www.shopping-list-app.com/api/auth/callback?code=impy1LYjtm_NCxy9&state=gr4jjt8aCe4FhpZpDdekFyy3Pm5j6kO4QSPz2aBm0RAkJdypzLm5RqrnppcIf57C

Error:
state mismatch, expected c3vX90aQxo7CQ2f81mQsCLQXAT197jWNIm1xNBE6nAkM3nnPZxK0axfwpMZnKYA0, got: gr4jjt8aCe4FhpZpDdekFyy3Pm5j6kO4QSPz2aBm0RAkJdypzLm5RqrnppcIf57C

I only get this error in production. Running on localhost presents no issues. Clearing localstorage and cookies still presents the same issue.

Auth Init: https://github.com/rosborne132/shopping-list-app/blob/master/lib/auth0.js
Auth API routes: shopping-list-app/src/pages/api/auth at master · rosborne132/shopping-list-app · GitHub

2 Likes

Hi @rosborne132

Have you found the cause of issue . It seems i am also falling into same type of issue.

Thanks