Skip to content

Commit

Permalink
fix: more strict default callback url handling
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Apr 20, 2022
1 parent fd755bc commit afdb3c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next-auth/src/core/lib/default-callbacks.ts
Expand Up @@ -5,7 +5,7 @@ export const defaultCallbacks: CallbacksOptions = {
return true
},
redirect({ url, baseUrl }) {
if (url.startsWith("/")) return new URL(url, baseUrl).toString()
if (url.startsWith("/")) return `${baseUrl}${url}`
else if (new URL(url).origin === baseUrl) return url
return baseUrl
},
Expand Down

0 comments on commit afdb3c8

Please sign in to comment.