KindeK
Kinde7mo ago
7 replies
teejays

Intermittent Error: `Authentication flow: State mismatch`

Hello all -- I am working on a project, and using Kinde for auth (which I quite love).

For this current project that I am working on, I've been intermittently getting this error as soon as I authenticate (with credentials).
{"error":"Authentication flow: State mismatch. Received: <some-string> | Expected: <some-other-string>"}

This error is shown on the URL "<mydomain>/api/auth/kinde_callback".

Stack:
Using Nextjs 15+, React 19+, kinde-oss/kinde-auth-nextjs ^2.8.0, deployed on Vercel.

I've been testing using the same browser, and the same account. The authentication works some of the times, but gives this error the other times.

I have verified that the following env variables are set on Vercel, and the domain is consistent:
KINDE_CLIENT_ID
KINDE_CLIENT_SECRET
KINDE_ISSUER_URL
KINDE_SITE_URL
KINDE_POST_LOGOUT_REDIRECT_URL
KINDE_POST_LOGIN_REDIRECT_URL


Is this a known issues? Any guidance around how to debug? Happy to provide more details (domain, account etc.) in DM.

TY!
Was this page helpful?