Skip to content

Instantly share code, notes, and snippets.

@SZharkov
Created January 21, 2020 17:33
Show Gist options
  • Save SZharkov/6fbc979848fd344ffd23ef6b4c4d28f3 to your computer and use it in GitHub Desktop.
Save SZharkov/6fbc979848fd344ffd23ef6b4c4d28f3 to your computer and use it in GitHub Desktop.

Revisions

  1. SZharkov created this gist Jan 21, 2020.
    5 changes: 5 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    // Node
    headers.set('Authorization', 'Basic ' + Buffer.from(username + ":" + password).toString('base64'));

    // Browser
    headers.set('Authorization', 'Basic ' + btoa(username + ":" + password));