fix: 🐛 Fix auth redirection
Tim Izzo tim@octree.ch
Mon, 03 Oct 2022 09:33:17 +0000
3 files changed,
9 insertions(+),
6 deletions(-)
M
backend/.gitignore
→
backend/.gitignore
@@ -113,4 +113,5 @@ *.cache
build .strapi-updater.json restart.test -dist/+dist/ +.strapi-updater.json
D
backend/.strapi-updater.json
@@ -1,5 +0,0 @@
-{ - "latest": "4.3.9", - "lastUpdateCheck": 1664350479043, - "lastNotification": 1664357206868 -}
M
frontend/pages/api/nauth/[...nextauth].js
→
frontend/pages/api/nauth/[...nextauth].js
@@ -75,6 +75,13 @@ session.user.lang = token.lang;
} return session; }, + async redirect({url, baseUrl}) { + // Allows relative callback URLs + if (url.startsWith('/')) return `${baseUrl}${url}`; + // Allows callback URLs on the same host + else if (new URL(url).host === new URL(baseUrl).host) return url; + return baseUrl; + }, }, pages: { signIn: '/auth/login',