Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrjcleaver/c377ab69eacc2eb6549e1fa8aafd1ec3 to your computer and use it in GitHub Desktop.
Save mrjcleaver/c377ab69eacc2eb6549e1fa8aafd1ec3 to your computer and use it in GitHub Desktop.
var username = '';
var password = '';
var encoded_credentials = new Buffer(username + ':' + password).toString('base64');
fetch('https://example.com', { method: 'POST', headers: {'Authorization': 'Basic ' + encoded_credentials} })
.then(function(res) {
return res.json();
})
.then(function(body) {
var output = {content: body};
callback(null, output);
})
.catch(callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment