-
-
Save anonymous/2032b0033e3c52959a27a987ec8d9bc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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