Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
Getting Started
Providers
Notion

Notion Provider

Resources

Setup

Callback URL

https://example.com/api/auth/callback/notion

Environment Variables

AUTH_NOTION_ID
AUTH_NOTION_SECRET
AUTH_NOTION_REDIRECT_URI

Configuration

/auth.ts
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,
    }),
  ],
})

Notes

  • You need to select “Public Integration” on the configuration page to get an oauth_id and oauth_secret. Private integrations do not provide these details.
  • You must provide a clientId and clientSecret to use this provider, as-well as a redirect URI (due to this being required by Notion endpoint to fetch tokens).
Auth.js © Balázs Orbán and Team - 2024