Get OAuth working for local (#10054)

Co-authored-by: Shivam Kalra <[email protected]>
This commit is contained in:
Hariom BalharaandShivam Kalra authored and GitHub committed 2023-07-19 09:15:05 +02:00
1 parent d0e831975d
commit b516a2af44
4 files changed
+32 -5

No files matched your search

+21
View File
@@ -446,6 +446,27 @@ const nextConfig = {
destination: "/apps/installed/conferencing",
permanent: true,
},
// OAuth callbacks when sent to localhost:3000(w would be expected) should be redirected to corresponding to WEBAPP_URL
...(process.env.NODE_ENV === "development" &&
// Safer to enable the redirect only when the user is opting to test out organizations
process.env.ORGANIZATIONS_ENABLED &&
// Prevent infinite redirect by checking that we aren't already on localhost
process.env.NEXT_PUBLIC_WEBAPP_URL !== "http://localhost:3000"
? [
{
has: [
{
type: "header",
key: "host",
value: "localhost:3000",
},
],
source: "/api/integrations/:args*",
destination: `${process.env.NEXT_PUBLIC_WEBAPP_URL}/api/integrations/:args*`,
permanent: false,
},
]
: []),
];
if (process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com") {