diff --git a/src/runtime/composables/local/useAuth.ts b/src/runtime/composables/local/useAuth.ts index 281874e6..cd4ff21c 100644 --- a/src/runtime/composables/local/useAuth.ts +++ b/src/runtime/composables/local/useAuth.ts @@ -60,8 +60,9 @@ const signIn: SignInFunc = async (credentials, signInOptions, const { redirect = true, external } = signInOptions ?? {} let { callbackUrl } = signInOptions ?? {} if (typeof callbackUrl === 'undefined') { - if (useRoute()?.query?.redirect) { - callbackUrl = useRoute().query.redirect.toString() + const redirectQueryParam = useRoute()?.query?.redirect + if (redirectQueryParam) { + callbackUrl = redirectQueryParam.toString() } else { callbackUrl = await determineCallbackUrl(runtimeConfig.public.auth, () => getRequestURLWN(nuxt))