Answers for "basic auth header in axios"

6

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 default headers authorization

axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
Posted by: Guest on September-29-2020
1

axios headers basic authorization

await axios.post(session_url, {}, {
  auth: {
    username: uname,
    password: pass
  }
});
Posted by: Guest on May-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language