You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When only one OAuth provider is configured, automatically redirect users straight into that provider’s universal-login flow instead of rendering the default “pick a provider” page.
Eliminate boilerplate of custom pages.signIn overrides, client- or server-side redirects, and extra API routes just to skip an unused UI.
Improve DX for common single-provider use cases (e.g. Auth0, Google-only apps) by providing an opt-in flag or built-in behavior.
Non-Goals
Removing the ability to render a custom sign-in page when multiple providers are configured.
Changing the existing default behavior when zero or more than one provider is present.
Introducing any breaking changes to the OAuth handshake or callback flows.
Background
Out of the box, Auth.js (v5) always renders a “pick-a-provider” page at /api/auth/signin, even if you’ve only configured a single OAuth provider. In practice, nearly every single-provider integration ends up with one of these workarounds:
• Pointing pages.signIn at the provider-specific endpoint (e.g. /api/auth/signin/auth0), which in turn requires custom API-route glue to avoid infinite GET/POST loops.
• Writing a client- or server-side redirect component at /signin to call signIn("auth0") or redirect("/api/auth/signin/auth0").
• Adding Next.js redirects/rewrites in next.config.js.
All of these solve the problem, but they’re boilerplate. A simple opt-in flag or built-in “if providers.length === 1 then redirect” behavior would streamline single-provider setups and reduce confusion for new users.
Proposal
importNextAuthfrom"next-auth"importAuth0from"next-auth/providers/auth0"exportdefaultNextAuth({providers: [Auth0({/* … */})],// New flag:autoRedirectOnSingleProvider: true,})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
Out of the box, Auth.js (v5) always renders a “pick-a-provider” page at /api/auth/signin, even if you’ve only configured a single OAuth provider. In practice, nearly every single-provider integration ends up with one of these workarounds:
• Pointing pages.signIn at the provider-specific endpoint (e.g. /api/auth/signin/auth0), which in turn requires custom API-route glue to avoid infinite GET/POST loops.
• Writing a client- or server-side redirect component at /signin to call signIn("auth0") or redirect("/api/auth/signin/auth0").
• Adding Next.js redirects/rewrites in next.config.js.
All of these solve the problem, but they’re boilerplate. A simple opt-in flag or built-in “if providers.length === 1 then redirect” behavior would streamline single-provider setups and reduce confusion for new users.
Proposal
Beta Was this translation helpful? Give feedback.
All reactions