Notion 提供商
资源
设置
回调 URL
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_id和oauth_secret。私有集成不提供这些详细信息。 - 您必须提供
clientId和clientSecret才能使用此提供商,以及重定向 URI(因为 Notion 端点需要此信息来获取令牌)。