Need to connect to an external api: Vogogo.The hard part is converting the curl example into a valid Meteor HTTP.get call. Now here is the code I came up with
apiversionVogogo = 'v3';
Vogogo.listAllCustomers = function() {
HTTP.get('https://api.vogogo.com/' + apiversionVogogo + '/customers', {
headers: {
'Authorization': {
user: clientID,
clientsecret: apisecret
}
}
},
function(error, result) {
if (error) {
console.log(error);
} else {
console.log(result);
}
});
return;
}
The response is an error message:
error_message: 'HTTP Authorization expected"'
Can someone help me rewrite this basic HTTP authentication into a default format? In the docs an example is given with CURL.
curl -X GET 'https://api.vogogo.com/v3/customers' \
--user clientsecret: \
-H "Content-Type: application/json"
Use the auth
parameter in the options field instead of actually setting the Authorization in the headers. From the Docs : auth String HTTP basic authentication string of the form "username:password"
. You're request would look like:
HTTP.get('https://api.vogogo.com/' + apiversionVogogo + '/customers', { auth : "clientID:apisecret"})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With