axios header authorization token code example

Example 1: axios bearer token

{
    headers: {
      'Authorization': 'Bearer ' + validToken()
    }
 }

Example 2: axios header authorization

// Send a GET request with the authorization header set to
// the string 'my secret token'
const res = await axios.get('https://httpbin.org/get', {
  headers: {
    authorization: 'my secret token'
  }
});

Example 3: add authorization header axios

// Send a GET request with the authorization header set to
// the string 'my secret token'
const res = await axios.get('https://httpbin.org/get', {
  headers: {
    'Authorization': 'my secret token'
  }
});