Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

User is not logged in #37

@Friis1978

Description

@Friis1978

Hi, I want to be able to know whether the user is logged in, using the useAuth() function, but it seemed like the user is never logged in, when using the $sanctumAuth.login.

Im able to call the protected routes on the api, so the csrf token is working as expected, but on locale host and in production, but the user is never set, using useAuth().

What am I doing wrong?
Screenshot 2023-07-27 at 11 15 55

This is the nuxt.config.js file

nuxtSanctumAuth: {
token: false,
baseUrl: process.env.NUXT_PUBLIC_API_URL || "https://endpoint",
endpoints: {
csrf: "/sanctum/csrf-cookie",
login: "/login",
logout: "/logout",
user: "/api/v1/user",
},
csrf: {
headerKey: 'X-XSRF-TOKEN',
cookieKey: 'XSRF-TOKEN',
tokenCookieKey: 'nuxt-sanctum-auth-token',
},
redirects: {
home: "/",
login: "/login",
logout: "/",
},
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions