Skip to content

Commit fb12a32

Browse files
committed
allow callback URLs on ECAS domain
1 parent 11675e1 commit fb12a32

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pages/api/auth/[...nextauth].ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,13 @@ export const authOptions: NextAuthOptions = {
168168
}
169169
},
170170
async redirect({ url, baseUrl }) {
171+
const ecasUrl = process.env.AUTH_ECAS_BASE_URL
171172
// Allows relative callback URLs
172173
if (url.startsWith('/')) return `${baseUrl}${url}`
173174
// Allows callback URLs on the same origin
174175
else if (new URL(url).origin === baseUrl) return url
176+
// Allows callback URLs on ECAS
177+
else if (new URL(url).origin === ecasUrl) return url
175178
//else if (process.env.AUTH_ECAS_GLOBAL_LOGOUT_URL === url) return url
176179
return baseUrl
177180
},

0 commit comments

Comments
 (0)