简体   繁体   English

Nuxt auth 向我返回 Bearer Bearer 令牌

[英]Nuxt auth returns me Bearer Bearer token

I am performing an authentication system with nuxtjs/auth, the main problem is that the token is sent from the back as follows: Bearer token...我正在使用 nuxtjs/auth 执行身份验证系统,主要问题是令牌是从后面发送的,如下所示: Bearer token...

When nuxtjs/auth processes it, it adds another Bearer to the beginning, being as follows: Bearer Bearer eyJhbGciOiJIUzU... nuxtjs/auth 处理的时候,在开头增加了一个 Bearer,如下: Bearer Bearer eyJhbGciOiJIUzU...

How can it be avoided?如何避免?

Here I have my strategy:在这里,我有我的策略:

  withoutotp: {
    _scheme: 'local',
    endpoints: {
      login: {
        url: '/users/v2/auth/bel',
        method: 'post',
        propertyName: 'response'
      },
      user: {
        url: '/users/v2/clients',
        method: 'get',
        propertyName: 'response'
      },
      logout: {
        url: '/users/v2/auth/logout',
        method: 'post'
      }
    }
  },

When you do have your string, use a slice(7) on it to remove the first Bearer.当你有你的字符串时,在它上面使用一个slice(7)来删除第一个 Bearer。

Just try setting tokenType: false in options.只需尝试在选项中设置tokenType: false It worked for me它对我有用

Having the same issue @Nuxt/Auth is saving token as Bearer%20{token}有同样的问题@Nuxt/Auth 正在将令牌保存为Bearer%20{token}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM