RFC2617 basic authorization header from username and password.
npm install basic-authorization-header --save
var basic = require('basic-authorization-header');
var headers = {
'Authorization': basic("Aladdin", "open sesame"),
};
//=> { Authorization: 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' }
user: (String)
username.pass: (String)
password.
(String)
basic authorization header value.
If you just want the token, check out basic-auth-token.