nuxt-auth
nuxt-auth copied to clipboard
addDefaultCallbackUrl for local auth not working
Environment
- Operating System: Darwin
- Node Version: v20.9.0
- Nuxt Version: 3.9.0
- CLI Version: 3.10.0
- Nitro Version: 2.8.1
- Package Manager: [email protected]
- Builder: -
- User Config: runtimeConfig, devtools, modules, i18n, auth, vuetify, vite
- Runtime Modules: @invictus.codes/[email protected], @sidebase/[email protected], @pinia/[email protected], @nuxtjs/[email protected]
- Build Modules: -
Reproduction
I'm using the following config:
globalAppMiddleware: {
isEnabled: true,
addDefaultCallbackUrl: true
},
baseURL: '/',
provider: {
type: 'local',
endpoints: {
signIn: { path: '/api/admin/login.php', method: 'post' },
signOut: { path: '/api/admin/logout.php', method: 'post' },
signUp: { path: '/api/admin/register.php', method: 'post' },
getSession: { path: '/api/admin/user.php', method: 'get' }
},
token: {
signInResponseTokenPointer: '/token'
},
},
Describe the bug
I'm not being redirected back to the page I initially visited. If I don't set a callbackUrl manually in the signIn request I get an alert with the following:
Error: Navigating to an external URL is not allowed by default. Use
navigateTo(url, { external: true })`.
Additional context
No response
Logs
No response
Hi @zoey-kaiser .
I too am curious about this issue.
Is it intended to make sure that the callback URL is set manually for local providers?
Personally, I believe that there are use cases, even for local providers, where you want to be taken to a certain page after login, such as addDefaultCallbackUrl: '/loggedIn'
.
If you agree with my idea, I would like to investigate and create a PR.
This looks like this is related to https://github.com/sidebase/nuxt-auth/issues/656