Closed kaboume closed 4 months ago
For anyone stumbling on this issue: If you need to redirect to an external URL you can pass the flag external
into the method to ensure this error does not occur and the redirect is handled properly:
// Trigger a sign-in with a redirect afterwards to an external page (if set, this will cause a hard refresh of the page)
const { signIn } = useAuth()
await signIn(credentials, { callbackUrl: 'https://sidebase.io', external: true })
Source: https://sidebase.io/nuxt-auth/application-side/session-access-and-management
I got the same error with a simple signIn
without any redirect:
const handleSubmit = async (e: Event) => {
e.preventDefault()
const credentials = {
password: password.value,
username: login.value,
}
isLoading.value = true
await signIn(credentials)
isLoading.value = false
}
So, the isLoading.value = false
is never reached.
Any idea?
Environment
Build Modules: -
Reproduction
nuxt.config.ts :
Describe the bug
Hi,
When the signin method is executed, this message is thrown :
MyLogin.vue:59 Error: Navigating to an external URL is not allowed by default. Use
navigateTo(url, { external: true })
. at navigateTo (router.js?v=07f3b5e0:74:13) at signIn (useAuth.mjs?v=07f3b5e0:33:12) at async Proxy.login (MyLogin.vue:50:5)Additional context
No response
Logs
No response