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
andoauth_secret
. Private integrations do not provide these details. - You must provide a
clientId
andclientSecret
to use this provider, as-well as a redirect URI (due to this being required by Notion endpoint to fetch tokens).