/** *
( options: OAuthUserConfig
& AdditionalConfig ): OAuthConfig
{ return { id: "notion", name: "Notion", type: "oauth", token: { url: `${NOTION_HOST}/v1/oauth/token`, }, userinfo: { url: `${NOTION_HOST}/v1/users`, // The result of this method will be the input to the `profile` callback. // We use a custom request handler, since we need to do things such as pass the "Notion-Version" header // More info: https://authjs.dev/getting-started/providers/notion async request(context) { const profile = await fetch(`${NOTION_HOST}/v1/users/me`, { headers: { Authorization: `Bearer ${context.tokens.access_token}`, "Notion-Version": NOTION_API_VERSION, }, }) const { bot: { owner: { user }, }, } = await profile.json() return user }, }, authorization: { params: { client_id: options.clientId, response_type: "code", owner: "user", redirect_uri: options.redirectUri, }, url: `${NOTION_HOST}/v1/oauth/authorize`, }, async profile(profile, tokens) { return { id: profile.id, name: profile.name, email: profile.person.email, image: profile.avatar_url, } }, style: { bg: "#fff", text: "#000" }, options, } }