Skip to content

Instantly share code, notes, and snippets.

@Ref-Bit
Created June 17, 2021 11:31
Show Gist options
  • Save Ref-Bit/6360413df9b0eecc0f9e5bb5d6d24e8e to your computer and use it in GitHub Desktop.
Save Ref-Bit/6360413df9b0eecc0f9e5bb5d6d24e8e to your computer and use it in GitHub Desktop.
Convert authentication info (username, password) to Basic token in NodeJS
const token = 'Basic ' + Buffer.from(`${username}:${password}`, 'utf8').toString('base64');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment