Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sabljakovich/2abf795f76944a3e8eccc4667461912f to your computer and use it in GitHub Desktop.
Save sabljakovich/2abf795f76944a3e8eccc4667461912f to your computer and use it in GitHub Desktop.
// Manual approach, there is a better way
const token = `${USERNAME}:${PASSWORD}`;
const encodedToken = Buffer.from(token).toString('base64');
const headers = { 'Authorization': 'Basic '+ encodedToken };
const user = await axios.post(BASE_URL+'/users', data, { headers })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment