Answers for "axios with header token"

7

axios bearer token

{
    headers: {
      'Authorization': 'Bearer ' + validToken()
    }
 }
Posted by: Guest on December-20-2020
2

axios set authorization header

const username = ''
const password = ''

const token = Buffer.from(`${username}:${password}`, 'utf8').toString('base64')

const url = 'https://...'

axios.post(url, {
  headers: {
    'Authorization': `Basic ${token}`
  }
})
Posted by: Guest on April-21-2020
-1

axios authorization bearer

const config = {
    headers: { Authorization: `Bearer ${token}` }
};

const bodyParameters = {
   key: "value"
};

Axios.post( 
  'http://localhost:8000/api/v1/get_token_payloads',
  bodyParameters,
  config
).then(console.log).catch(console.log);
Posted by: Guest on April-21-2021

Browse Popular Code Answers by Language