简体   繁体   中英

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...

When nuxtjs/auth processes it, it adds another Bearer to the beginning, being as follows: 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.

Just try setting tokenType: false in options. It worked for me

Having the same issue @Nuxt/Auth is saving token as Bearer%20{token}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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