nuxt-community / auth-module

Zero-boilerplate authentication support for Nuxt 2
https://auth.nuxtjs.org
MIT License
1.93k stars 925 forks source link

setUser does not change the loggedIn state variable and requires a page reload to work. #1337

Open jonalxh opened 3 years ago

jonalxh commented 3 years ago

Version

module: ^5.0.0-1624817847.21691f1 nuxt: 2.15.8

Nuxt configuration

mode:

Nuxt configuration

auth: {
    plugins: ['~/plugins/auth'],
    rewriteRedirects: true,
    fullPathRedirect: true,
    strategies: {
      cookie: {
        cookie: {
          name: "sessionid"
        },
        endpoints: {
          login: {
            url: `auth/login/`,
            method: 'post',
            //propertyName: false,
            //withCredentials: true
          },
          logout: {
            url: 'auth/logout/',
            method: 'post'
          },
          user: {
            url: `user`,
            method: 'get',
          },
        },
        tokenRequired: false,
        tokenType: false,
        user: {
          autoFetch: true,
          property: false,
          withCredentials: true,
        }
      },
      google: {
        clientId: credentials.GoogleAuthCredentials.client_id,
        redirectUri: isProd ? baseUrl : baseDevUrl,
        logoutRedirectUri: isProd ? baseUrl : baseDevUrl,
        codeChallengeMethod: "",
        responseType: "code",
        token: {
          property: 'access_token',
          type: 'Bearer',
        },
        refreshToken: {
          property: 'refresh_token',
        },
        endpoints: {
          token: `${baseApiUrl}auth/google/`,
          refresh: {
            url: `${baseApiUrl}auth/google/`,
            method: 'post'
          },
          userInfo: `${baseApiUrl}user`,
        },
        autoLogout: false
      }
    },
    redirect: {
      login: '/',
      logout: '/',
      callback: '/',
      home: '/'
    }
}

Reproduction

:warning: without a minimal reproduction we won't be able to look into your issue