Skip to content

Instantly share code, notes, and snippets.

/visa.js Secret

Created December 7, 2016 18:52
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 anonymous/2032b0033e3c52959a27a987ec8d9bc7 to your computer and use it in GitHub Desktop.
Save anonymous/2032b0033e3c52959a27a987ec8d9bc7 to your computer and use it in GitHub Desktop.
const request = require('superagent');
const config = require('./config/visa.json')
const userId = config.userId;
const password = config.password;
const authString = getBasicAuthHeader(userId, password);
console.log(authString);
function getBasicAuthHeader(userId, password) {
return 'Basic ' + new Buffer(userId + ':' + password).toString('base64');
}
request
.get('https://sandbox.api.visa.com/vmorc/offers/v1/all')
.set('Authorization', authString)
.set('Accept', 'application/json')
.then(res => {
console.log(res)
})
.catch(err => {
console.log(`ERR: ${err.response.text}`)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment