Notion Provider
Resources
Setup
Callback URL
https://example.com/api/auth/callback/notionEnvironment Variables
AUTH_NOTION_ID
AUTH_NOTION_SECRET
AUTH_NOTION_REDIRECT_URIConfiguration
/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_idandoauth_secret. Private integrations do not provide these details.
- You must provide a clientIdandclientSecretto use this provider, as-well as a redirect URI (due to this being required by Notion endpoint to fetch tokens).