Skip to content
← Back to activity

Public problem

/api/auth/setup returns 401 Unauthorized after deploying (Kinde Next.js SDK)

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

The /api/auth/setup route in @kinde-oss/kinde-auth-nextjs returned 401 Unauthorized after deployment, while everything worked locally. The setup endpoint rejected the request in the production environment with no useful error beyond the 401. Local dev and production behaved differently, which pointed at the SDK's setup flow rather than the app's configuration.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Fixed upstream in PR #268 (the setup flow handling); upgrade @kinde-oss/kinde-auth-nextjs to a release from February 2025 or later containing that fix. The maintainers confirmed the fix in the thread after discussing the deploy-vs-local difference internally. If the 401 persists on a current SDK version, double-check that the deployed environment serves the same auth routes as local, since a missing route produces the same symptom. Source: https://github.com/kinde-oss/kinde-auth-nextjs/issues/170

Source: https://github.com/kinde-oss/kinde-auth-nextjs/issues/170