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

providers/notion

內建的 Notion 整合。

NotionProfile

繼承

屬性

access_token

access_token: string;

bot_id

bot_id: string;

duplicated_template_id

duplicated_template_id: string;

owner?

optional owner: Owner;

workspace_icon

workspace_icon: string;

workspace_id

workspace_id: number;

workspace_name

workspace_name: string;

Owner

屬性

type

type: string;

user

user: User;

Person

繼承

屬性

email

email: string;

User

繼承

屬性

avatar_url

avatar_url: null | string;

id

id: string;

name

name: string;

object

object: "user" | "bot";

owner?

optional owner: {
  type: "user" | "workspace";
  workspace: string;
};
type
type: "user" | "workspace";
workspace
workspace: string;

person

person: Person;

type

type: string;

workspace_name?

optional workspace_name: null | string;

default()

default<P>(options): OAuthConfig<P>

將 Notion 登入新增到您的頁面。

設定

回調 URL

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

組態設定

import { Auth } from "@auth/core"
import Notion from "@auth/core/providers/notion"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [
    Notion({
      clientId: NOTION_CLIENT_ID,
      clientSecret: NOTION_CLIENT_SECRET,
      redirectUri: NOTION_CLIENT_REDIRECT_URI,
    }),
  ],
})

資源

注意事項

您需要在組態設定頁面中選取「公開整合」,才能取得 oauth_idoauth_secret。 私人整合不會提供這些詳細資料。您必須提供 clientIdclientSecret 才能使用此供應商,以及重新導向 URI (因為 Notion 端點需要它才能擷取權杖)。

💡

Notion 供應商具有預設組態。若要覆寫您使用案例的預設值,請查看自訂內建 OAuth 供應商

免責聲明 如果您認為在預設組態中發現錯誤,您可以開啟問題

Auth.js 嚴格遵守規範,並且不對供應商的任何規格偏差負責。 您可以開啟問題,但如果問題是不符合規格,我們可能不會尋求解決方案。 您可以在討論中尋求更多協助。

類型參數

類型參數
P 延伸 NotionProfile

參數

參數類型
optionsOAuthUserConfig<P> & AdditionalConfig

返回

OAuthConfig<P>

Auth.js © Balázs Orbán 和團隊 -2024