[Vuejs]-Axios – unable to set global Authorization header

0👍

Looks like response.data.api_token is not a pure string but an object. If you change your header-setting line to:

axios.defaults.headers.common['Authorization'] = JSON.stringify(store.getters.token)

the problem should be easier to diagnose.

Also, unless you do something bespoke, you also need to set an authorization type in the header value, so that the value becomes Bearer <token> or Basic <token>

Leave a comment