adds a custom redirect callback that also let's urls with origin WEBSITE-URL (app.cal.com) pass, otherwise redirected to cal.com instead of app.cal.com on callback
parent
4afb2946a7
commit
6842c13ea1
|
@ -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 === baseUrl || WEBSITE_URL) return url;
|
||||
return baseUrl;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue