auth-module: Why @nuxt/auth-next doesn't fetch user automatically after successfully login?

Hello, why @nuxt/auth not fetch user endpoint automatically after login success? here’s the screenshot and here’s the current config (i’ve tried almost everything). Thank you

The cookies image

The request image

nuxt.config.js

// ...
    auth: {
        strategies: {
            local: {
                scheme: 'refresh',
                token: {
                    property: 'access_token',
                    maxAge: 1800,
                    type: 'Bearer'
                },
                refreshToken: {
                    property: 'refresh_token',
                    data: 'refresh_token',
                    maxAge: 60 * 80 * 24
                },
                user: {
                    property: 'user',
                    autoFetch: true
                },
                endpoints: {
                    user: { url: "/api/v1/u/me", method: "get", propertyName: "user" },
                    login: { url: '/api/v1/auth/login', method: 'post', propertyName: "access_token" },
                    refresh: { url: '/api/v1/auth/refresh', method: 'post', propertyName: "refresh_token" },
                    // logout: false
                    logout: { url: '/api/v1/auth/logout', method: 'delete' }
                }
            }
        },
        cookie: {
            options: {
                sameSite: 'lax',
            },
        },
        redirect: {
            login: '/',
            logout: '/',
            callback: '/dash',
            home: '/dash'
        }
    }

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20

Most upvoted comments

Hi @fahmiegerton! I believe we’re close to find where is the issue. If your login request is successful, then the problem should be related either to the internal check or the fetchUser method. Do you have Discord, so we can work better on this? Joao Pedro AS51#1284

@samirmhsnv You can also add me on Discord if you want.

Hi @samirmhsnv! Can you open a new issue for your case? I believe it’s not related to this one. Then I’ll be able to look better at it. Thank you in advance 😃