Created
January 22, 2020 14:54
-
-
Save okovalov/c66625c3365387c8682c6aa52e47cb46 to your computer and use it in GitHub Desktop.
Learn how to send the authorization header using Axios (from https://flaviocopes.com/axios-send-authorization-header/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const username = '' | |
const password = '' | |
const token = Buffer.from(`${username}:${password}`, 'utf8').toString('base64') | |
const url = 'https://...' | |
axios.post(url, { | |
headers: { | |
'Authorization': `Basic ${token}` | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment