diff options
| author | Dhravya Shah <[email protected]> | 2025-03-30 20:30:14 -0700 |
|---|---|---|
| committer | Dhravya Shah <[email protected]> | 2025-03-30 20:30:14 -0700 |
| commit | c34a3352acdf7b26e1332284b4ecc4776dabf9b3 (patch) | |
| tree | 31f86c53ecd5d6479140912f6ab2326e2929552f /apps/web/server | |
| parent | settings openapi (diff) | |
| download | supermemory-c34a3352acdf7b26e1332284b4ecc4776dabf9b3.tar.xz supermemory-c34a3352acdf7b26e1332284b4ecc4776dabf9b3.zip | |
Fix: notion integration
Diffstat (limited to 'apps/web/server')
| -rw-r--r-- | apps/web/server/index.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/web/server/index.ts b/apps/web/server/index.ts index 09cd6af0..0cea72e7 100644 --- a/apps/web/server/index.ts +++ b/apps/web/server/index.ts @@ -351,6 +351,11 @@ app.all("/auth/notion/callback", zValidator("query", z.object({ code: z.string() const notionCredentials = btoa(`${c.env.NOTION_CLIENT_ID}:${c.env.NOTION_CLIENT_SECRET}`); + const redirectUri = c.env.NODE_ENV === "development" + ? "http://localhost:3000/auth/notion/callback" + : "https://supermemory.ai/auth/notion/callback"; + console.log(redirectUri) + const response = await fetch("https://api.notion.com/v1/oauth/token", { method: "POST", headers: { @@ -360,10 +365,7 @@ app.all("/auth/notion/callback", zValidator("query", z.object({ code: z.string() body: JSON.stringify({ grant_type: "authorization_code", code: code, - redirect_uri: - c.env.NODE_ENV === "production" - ? "https://supermemory.ai/auth/notion/callback" - : "http://localhost:3000/auth/notion/callback", + redirect_uri: redirectUri, }), }); @@ -381,6 +383,7 @@ app.all("/auth/notion/callback", zValidator("query", z.object({ code: z.string() const success = !(data as any).error; if (!success) { + console.error("Failed to get Notion access token:", data, (data as any).error); return c.redirect(`/?error=${(data as any).error}`); } |