KindeK
Kinde13mo ago
4 replies
Bini

Authentication Issue on Vercel Deployment

Hi Kinde team,

I'm having trouble with Kinde auth in my Vite + React + TS app when deployed to Vercel. Everything works fine on my local env, but the auth flow breaks after deploying.

Problem Summary:

- User visits /some/protected
- ProtectedRoute component checks isAuthenticated (false)
- Redirects to /auth/login
- LoginRoute component triggers Kinde login
- User authenticates through Kinde
- onRedirectCallback is called, redirecting user back to original protected route
- ProtectedRoute still sees isAuthenticated as false and redirects to /auth/login

Expected Behavior:

After successful Kinde login, user should be redirected back to /some/protected and recognised as authenticated, allowing access to protected routes

Environment:

* Frontend: React (Vite), TypeScript, @kinde-oss/kinde-auth-react (v. 4.0.4)
* Deployment: Vercel

Troubleshooting Done:

* Verified environment variables on Vercel (VITE_KINDE_CLIENT_ID, VITE_KINDE_DOMAIN, VITE_KINDE_REDIRECT_URL).
* Confirmed https://foobar.vercel.app/ is in Kinde's "Allowed callback URLs" and "Allowed logout redirect URLs" (without trailing slash).
Was this page helpful?