Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Auth.js · Const

Notion

Auth.js includes a built-in Notion OAuth provider. Configure it with Notion credentials and a redirect URI, then register the matching callback URL.

How it works

The Notion provider adds Notion OAuth login to Auth.js. Configure it with the provider credentials and a redirect URI, then register the matching callback URL in the Auth.js setup.

Syntax

Notion(options)

Parameters

NameTypeDescription
optionsOAuthUserConfig<P> & AdditionalConfigOAuth provider options, including credentials and the required redirect URI.

Returns

OAuthConfig<P>

Key points

  • Auth.js provides Notion as a built-in OAuth integration, so no custom provider implementation is needed.
  • For a Next.js deployment using the standard API route, the callback endpoint is /api/auth/callback/notion.
  • The provider supplies default OAuth configuration that can be used without redefining its endpoints.
  • Pass options to the provider factory when the built-in configuration needs customization.
  • The factory accepts OAuth user configuration combined with additional provider configuration.

Common mistakes

  • Create the Notion application as a Public Integration; private integrations do not expose the credentials needed here.
  • All three values are required: client ID, client secret, and redirect URI.

Example: Configure Notion authentication

import NextAuth from "next-auth"
import Notion from "next-auth/providers/notion"

export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [
    Notion({
      clientId: process.env.AUTH_NOTION_ID,
      clientSecret: process.env.AUTH_NOTION_SECRET,
      redirectUri: process.env.AUTH_NOTION_REDIRECT_URI,
    }),
  ],
})

Registers Notion as an Auth.js provider and supplies the credentials and redirect URI required by Notion.

When to use it

Notion sign-in

Users authenticate to an application with their Notion account.

Environment-based provider configuration

An application needs OAuth credentials supplied through environment variables.

Custom callback configuration

A deployment requires a non-default redirect endpoint.

Interview questions

QHow do you configure Notion OAuth in Auth.js?

Use the built-in Notion provider and pass clientId, clientSecret, and redirectUri to it. Register the corresponding callback URL with the Auth.js route.

Follow-up: Why is the redirect URI explicitly configured? Notion requires it when exchanging the authorization result for tokens.

QWhat callback URL should be registered for Notion?

The callback path is provider-specific and ends with /callback/notion; in a Next.js deployment, the documented example is /api/auth/callback/notion.

Follow-up: What must be changed for another base path? Register the same callback suffix under that deployment's configured Auth.js base path.

QWhat does the Notion provider configure automatically?

The provider is built in and already has default OAuth settings. Override those defaults by passing options to the provider function, such as credentials and the redirect URI.

Follow-up: How are custom options applied? Auth.js deeply merges provider-call options with the built-in defaults.

  • NotionProfile
  • OAuthUserConfig
  • OAuthConfig
  • customizing a built-in OAuth provider

Source: Notion Provider. Checked 2026-10-15.