diff --git a/docs/pages/getting-started/providers/notion.mdx b/docs/pages/getting-started/providers/notion.mdx index 32aca0008a..2ca6aaa5c5 100644 --- a/docs/pages/getting-started/providers/notion.mdx +++ b/docs/pages/getting-started/providers/notion.mdx @@ -138,3 +138,4 @@ app.use( - 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 OAuth API doesn’t support refreshing tokens, and so doesn’t return a refresh token. The access token never expires. diff --git a/packages/core/src/providers/notion.ts b/packages/core/src/providers/notion.ts index d96820cfcf..b9ad29d19b 100644 --- a/packages/core/src/providers/notion.ts +++ b/packages/core/src/providers/notion.ts @@ -118,6 +118,13 @@ export default function NotionProvider

( type: "oauth", token: { url: `${NOTION_HOST}/v1/oauth/token`, + async conform(response) { + const body = await response.json() + if (body?.refresh_token === null) { + delete body.refresh_token + } + return new Response(JSON.stringify(body), response) + }, }, userinfo: { url: `${NOTION_HOST}/v1/users`,