dystcz / nuxt-sanctum-auth

Nuxt 3 + laravel sanctum authentication
135 stars 25 forks source link

Not working. The login request returns the user, but i get redirected back to login page after login. #20

Closed EdnaldoNeimeg closed 1 year ago

EdnaldoNeimeg commented 1 year ago

This is config i'm using:

nuxtSanctumAuth: { token: false, // set true to use jwt-token auth instead of cookie. default is false baseUrl: "http://api.lavanderia.site", endpoints: { csrf: "/sanctum/csrf-cookie", login: "/api/login", logout: "/api/logout", user: "/api/user", }, csrf: { headerKey: "X-XSRF-TOKEN", cookieKey: "XSRF-TOKEN", tokenCookieKey: "nuxt-sanctum-auth-token", }, redirects: { home: "/", login: "/login", logout: "/", }, },

After login, when the request to /api/user is made i see that Authorization and XSRF tokens are not ser in request headers.

image

EdnaldoNeimeg commented 1 year ago

Actually, it was happening because Nuxt and Laravel are running in different domains. Closing.