Skip to content

Commit

Permalink
Merge branch 'main' into fix/970-authjs-better-redirect-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
zoey-kaiser authored Jan 16, 2025
2 parents e990d39 + 85034e0 commit a85f79e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/runtime/composables/local/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,18 @@ const signIn: SignInFunc<Credentials, any> = async (credentials, signInOptions,
await nextTick(getSession)
}

let { callbackUrl } = signInOptions ?? {}
if (typeof callbackUrl === 'undefined') {
const redirectQueryParam = useRoute()?.query?.redirect
if (redirectQueryParam) {
callbackUrl = redirectQueryParam.toString()
}
else {
callbackUrl = await determineCallbackUrl(runtimeConfig.public.auth, () => getRequestURLWN(nuxt))
}
}
if (redirect) {
let { callbackUrl } = signInOptions ?? {}
if (typeof callbackUrl === 'undefined') {
const redirectQueryParam = useRoute()?.query?.redirect
if (redirectQueryParam) {
callbackUrl = redirectQueryParam.toString()
}
else {
callbackUrl = await determineCallbackUrl(runtimeConfig.public.auth, () => getRequestURLWN(nuxt))
}
}

return navigateTo(callbackUrl, { external })
}
}
Expand Down

0 comments on commit a85f79e

Please sign in to comment.