Nuxt auth returns me Bearer Bearer token

1.1k Views Asked by At

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'
      }
    }
  },
2

There are 2 best solutions below

0
On

When you do have your string, use a slice(7) on it to remove the first Bearer.

1
On

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