nuxt-auth icon indicating copy to clipboard operation
nuxt-auth copied to clipboard

addDefaultCallbackUrl for local auth not working

Open blaaat opened this issue 1 year ago • 2 comments

Environment

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

blaaat avatar Dec 27 '23 08:12 blaaat

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.

nojiritakeshi avatar Jan 18 '24 16:01 nojiritakeshi

This looks like this is related to https://github.com/sidebase/nuxt-auth/issues/656

bitfactory-frank-spee avatar Mar 05 '24 12:03 bitfactory-frank-spee