Error: State not Found
Hey, i'm building my pet project with Next Js and Kinde, but I'm a bit stuck with State not found error that i've encoutered for a while
At first localhost was working correctly and error appeared only with deployed version, but it's in both versions.
I'm hosting with Firebase
I'm using my own custom domain, but i have a feeling I might have set it up wrong
KINDE_ISSUER_URL=https://theinterior.site
KINDE_SITE_URL=https://theinterior.site
KINDE_POST_LOGOUT_REDIRECT_URL=https://theinterior.site
KINDE_POST_LOGIN_REDIRECT_URL=https://theinterior.site
KINDE_REDIRECT_URI=https://theinterior.site/api/auth/kinde_callback
and here is Kinde setup:
Application homepage URI
https://theinterior.site
Application login URI: i've tried both
https://my-name.kinde.com/login/callback
https://theinterior.site/login/callback
Allowed callback URLs
http://localhost:3000/api/auth/kinde_callback
https://theinterior.site/api/auth/kinde_callback
Allowed logout redirect URLs
http://localhost:3000
https://theinterior.site
P.S. I also received a different error - ERR_TOO_MANY_REDIRECTS
Let me know if you need any additional info,
That's my first full scale project done on my own and I feel like I missed some things there with the setup.
Interior
Furniture Store
2 Replies
Hi there. You env values need to use the Kinde domain URLs and not your custom domain. Give that a try and let us know how you go.
Thank you for the answer!
Yes, i switched back to Kinde domain and I'm back to the state not found message: {"error":"Error: State not found.\nTo resolve this error please visit our docs https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk/#state-not-found-errorAuthentication flow: Received: 5e25cf7ffb3e8cf32b380e28d513 | Expected: State not found"}
localhost auth works fine though
Kinde docs
Next.js App Router SDK
Our developer tools provide everything you need to get started with Kinde.