nuxt-alt / auth

An alternative module to @nuxtjs/auth
https://nuxt-alt-auth.vercel.app/
MIT License
113 stars 20 forks source link

Redirect doesn't work on login #31

Closed mkael1 closed 1 year ago

mkael1 commented 1 year ago

Version ^2.3.2

On logout it works, but when I try to login it doesn't redirect to /

  auth: {
    strategies: {
      laravelSanctum: {
        sessionStorage: true,
        provider: "laravel/sanctum",
        url: process.env.API_URL,
        endpoints: {
          csrf: {
            url: '/sanctum/csrf-cookie',
          },
          login: {
            url: "/api/admin/login"
          },
          user: {
            url: "/api/admin/user"
          },
          logout: {
            url: "/api/admin/logout"
          }
        }
      }
    },
    redirect: {
      login: "/login",
      logout: "/login",
      callback: "/login",
      home: "/"
    }
  },
betsaleel777 commented 1 year ago

same issue for me, there is no example to use this package

ttonyh commented 1 year ago

Try this and see if it works

Have the following in your Auth config (might not need all but at least "rewriteRedirects", "redirect.home", and "watchLoggedIn"):

auth: {
...
    rewriteRedirects: true,
    watchLoggedIn: true,
    redirectStrategy: 'query',
    redirect: {
        ...
        home: '/'
    },

...
}

Add this in your sign-in page in the "setup()" or the " Githubissues.

  • Githubissues is a development platform for aggregating issues.