Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to implement my own authentification system

For the front im using Nuxtjs, and the back Nestjs,

When im logging in, i receive my auth JWT, while i dont refresh the page or change current page there is no problem, but when i'm leaving current page and i request my backend there is no more Authorization headers with received JWT

that's my @nuxt/auth config:

  auth: {
    strategies: {
      local: {
        token: {
          property: 'access_token',
        },
        user: {
          property: 'user',
        },
        endpoints: {
          login: { url: '/api/auth/login', method: 'post' },
          logout: false,
          user: { url: '/api/auth/user', method: 'get' },
        },
      },
    },
  },

and my login function

async userLogin() {
      try {
        let response = await this.$auth.loginWith('local', { data: this.login })
        console.log(this.$auth.user)
      } catch (err) {}
    },

can someone help me ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...