KindeK
Kinde7mo ago
22 replies
Neil E.

Can't get Kinde nextjs working in Cloudflare worker

I'm trying to integrate Kinde into my opennextjs app. In local development everything is great. I can authenticate, and use permissions to selectively grant access to pages. It's super cool.

In my dev deployment using opennextjs to a Cloudflare worker, however, it doesn't work at all. After logging in I either get one of these two errors:

Error: State not found.

Attempting to commit invalid access_token token

I've gone through the guide at https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk/#state-not-found-error several times, and triple checked that my environment variables at build time in GitHub and deploy time in Cloudflare match and look correct.

Anyone have tips on how to troubleshoot what is wrong here? I assume it is a config/environment variable/mismatch somewhere, but I can't for the life of me see it.
Was this page helpful?