跳至內容
從 NextAuth.js v4 遷移?請閱讀 我們的遷移指南.

Notion 供應商

資源

設定

回呼網址

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

環境變數

AUTH_NOTION_ID
AUTH_NOTION_SECRET
AUTH_NOTION_REDIRECT_URI

組態

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

注意事項

  • 您需要在組態頁面上選擇「公開整合」才能取得 oauth_idoauth_secret。私有整合不會提供這些詳細資訊。
  • 您必須提供 clientIdclientSecret 才能使用此供應商,以及重新導向 URI(由於 Notion 端點需要此選項才能擷取權杖)。
Auth.js © Balázs Orbán 和團隊 -2024