Skip to content

Troubleshooting: Google OAuth

  • After Google consent, user is redirected to login/error instead of dashboard.
  • Browser shows Authentication failed or Invalid token received.
  • Backend callback route appears to run, but frontend never gets valid session.
  • Google OAuth screen shows redirect_uri_mismatch.
  • Google OAuth redirect URI does not exactly match backend callback URL.
  • Backend GOOGLE_CALLBACK_URL is outdated or uses an old domain.
  • Frontend/backend URLs changed (new Koyeb or Vercel domain) but OAuth config was not updated.
  • Frontend env (VITE_GOOGLE_AUTH_URL) points to the wrong backend domain.
  • CORS/routing issues prevent auth callback flow from completing.
  1. Verify backend callback URL works:
    • https://api.korta.click/api/v1/auth/google/callback
  2. Check Google Cloud OAuth client config:
    • Authorized JavaScript origins includes:
      • https://korta.click/
    • Authorized redirect URIs includes:
      • https://api.korta.click/api/v1/auth/google/callback
  3. Check backend env vars:
    • GOOGLE_CLIENT_ID
    • GOOGLE_CLIENT_SECRET
    • GOOGLE_CALLBACK_URL=https://api.korta.click/api/v1/auth/google/callback
    • FRONTEND_URL=https://korta.click/
  4. Check frontend env:
    • VITE_GOOGLE_AUTH_URL=https://api.korta.click/api/v1/auth/google
  5. Redeploy both services after env/config changes.
  • Make all OAuth URLs exact and consistent across:
    • Google Console
    • Backend env
    • Frontend env
  • Remove stale domains from callback/origin settings.
  • Ensure backend service is mounted at public path / on Koyeb.
  • Ensure production frontend uses the same domain configured in Google origins.
  • Clicking “Continue with Google” opens Google consent correctly.
  • After consent, user is redirected to frontend callback route and then dashboard.
  • Frontend stores accessToken and authenticated routes load.
  • GET /api/v1/auth/me succeeds with Bearer token after OAuth login.