Pinterest social login
Allow users to sign in or register through Pinterest in a Next.js application.
Auth.js · Const
Auth.js provides a built-in Pinterest OAuth provider. Add Pinterest to the providers list and configure AUTH_PINTEREST_ID and AUTH_PINTEREST_SECRET for the standard setup.
Pinterest is a built-in OAuth 2 provider. Add the provider to Auth.js, define the Pinterest credentials using the expected environment-variable names, and register the generated callback URL in the Pinterest app configuration.
Pinterestimport NextAuth from "next-auth"
import Pinterest from "next-auth/providers/pinterest"
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [Pinterest],
})Register the built-in Pinterest provider with Auth.js; credentials are inferred from the Pinterest environment variables.
Allow users to sign in or register through Pinterest in a Next.js application.
Connect a Pinterest developer application to an Auth.js deployment.
Use Auth.js's standard Pinterest OAuth behavior without custom provider settings.
The built-in provider is imported from next-auth/providers/pinterest and added to the providers array. Auth.js can infer its credentials from AUTH_PINTEREST_ID and AUTH_PINTEREST_SECRET.
Follow-up: What callback URL should a Next.js deployment register? Use https://example.com/api/auth/callback/pinterest, replacing the domain with the deployment's domain.
The provider uses Pinterest's OAuth 2 flow and supplies a default configuration. Passing the provider directly is enough for the standard setup; customization is available when defaults do not fit.
Follow-up: How would you customize the built-in provider? Call Pinterest({...}) with provider options and pass that configured result in the providers array.
Pinterest requires an application ID and secret. Auth.js recognizes the conventional names AUTH_PINTEREST_ID and AUTH_PINTEREST_SECRET, so the provider can be registered without explicitly passing those values.
Follow-up: What changes if environment-variable inference is not used? Pass the credentials explicitly through the provider's configuration options.
OAuthConfigPinterestProfilecustomizing a built-in OAuth providerOAuth providers