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('/' + 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 '' \
--user clientsecret: \
-H "Content-Type: application/json"
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./' + 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./v3/customers' \
--user clientsecret: \
-H "Content-Type: application/json"
Share
Improve this question
edited Jul 24, 2015 at 11:31
Fullhdpixel
asked Jul 24, 2015 at 11:25
FullhdpixelFullhdpixel
8231 gold badge13 silver badges28 bronze badges
3
-
1
Did you try setting the
auth
paramater in the options field instead of actually setting theAuthorization
in the headers? From Docs :auth String HTTP basic authentication string of the form "username:password"
– Nate Commented Jul 24, 2015 at 12:41 -
so that your request would look like
HTTP.get('https://api.vogogo./' + apiversionVogogo + '/customers', { auth : "clientID:apisecret"})
– Nate Commented Jul 24, 2015 at 12:42 - Thanks Nate! That worked like a charm :) – Fullhdpixel Commented Jul 24, 2015 at 12:56
1 Answer
Reset to default 10Use 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./' + apiversionVogogo + '/customers', { auth : "clientID:apisecret"})