Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
notion

providers/notion

Built-in Notion integration.

NotionProfile

Extends

  • Record<string, any>

Properties

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

Properties

type

type: string;

user

user: User;

Person

Extends

  • Record<string, any>

Properties

email

email: string;

User

Extends

  • Record<string, any>

Properties

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>

Add Notion login to your page.

Setup

Callback URL

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

Configuration

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

Resources

Notes

You need to select “Public Integration” on the configuration page to get an oauth_id and oauth_secret. Private integrations do not provide these details. You must provide a clientId and clientSecret to use this provider, as-well as a redirect URI (due to this being required by Notion endpoint to fetch tokens).

💡

The Notion provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.

Disclaimer If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Type parameters

Type parameter
P extends NotionProfile

Parameters

ParameterType
optionsOAuthUserConfig<P> & AdditionalConfig

Returns

OAuthConfig<P>

Auth.js © Balázs Orbán and Team - 2024