Social sign-in
Users authenticate with their Naver accounts in a Next.js application.
Auth.js · Const
Naver is a built-in Auth.js OAuth provider. Add it to the providers list and configure the Naver client ID and secret through the documented environment variables.
Naver is a built-in OAuth provider that adds Naver sign-in to Auth.js. In Next.js, register the provider in the Auth.js configuration and supply the Naver application credentials through environment variables.
Naver(options?: OAuthUserConfig<P>): OAuthConfig<P>| Name | Type | Description |
|---|---|---|
options | OAuthUserConfig<P> | Provider options, including OAuth configuration overrides and an optional profile type parameter. |
OAuthConfig<P>
import NextAuth from "next-auth"
import Naver from "next-auth/providers/naver"
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [Naver],
})This registers Naver as an OAuth provider in a Next.js Auth.js configuration. Auth.js reads the client credentials from the documented environment variables.
Users authenticate with their Naver accounts in a Next.js application.
An application needs Naver OAuth settings with selected defaults changed.
A multi-provider Auth.js deployment offers Naver alongside other identity providers.
Naver is added by importing the provider and placing it in the providers array passed to NextAuth. The Next.js integration can use the provider directly because Auth.js supplies its built-in configuration.
Follow-up: What credentials are needed? Set AUTH_NAVER_ID and AUTH_NAVER_SECRET so Auth.js can infer the Naver client credentials.
For Next.js, Naver redirects back to https://example.com/api/auth/callback/naver after authorization. The callback URL must match the value configured in the Naver developer console.
Follow-up: How does the callback path differ outside Next.js? Other documented integrations use /auth/callback/naver instead of /api/auth/callback/naver.
The provider factory accepts OAuthUserConfig<P> and returns OAuthConfig<P>, where P extends NaverProfile. This allows provider options and the profile type to remain strongly typed.
Follow-up: How can defaults be changed? Pass an options object to Naver and override the built-in OAuth configuration values needed by the application.
NaverProfileOAuthUserConfigOAuthConfigNextAuthproviders