Skip to content

Scheduling infrastructure for absolutely everyone.

Fix adds redirect callback that support app.cal.com (#2768)

Agusti Fernandez Pardo9c52e195ea77
diff --git a/apps/web/pages/api/auth/[...nextauth].tsx b/apps/web/pages/api/auth/[...nextauth].tsx
index 574951f70e6..b30a18a335e 100644
--- a/apps/web/pages/api/auth/[...nextauth].tsx
+++ b/apps/web/pages/api/auth/[...nextauth].tsx
@@ -434,5 +434,12 @@ export default NextAuth({
return false;
},
+ async redirect({ url, baseUrl }) {
+ // Allows relative callback URLs
+ if (url.startsWith("/")) return `${baseUrl}${url}`;
+ // Allows callback URLs on the same origin
+ else if (new URL(url).origin === new URL(baseUrl || WEBSITE_URL).origin) return url;
+ return baseUrl;
+ },
},
});