Hi All,
I have an requirement to set Basic authentication in the HTTP header. This is required within a javascript because I need to call edge management api through JavaScript.
Can anyone please provide me a working example?
I did the following way
var headers = {Authorization : ‘Bearer c3V2b2ppd…xxxxx…==’};
var url = “https://api.enterprise.apigee.com/v1/organizations/rssoftwarestaging/apps/”
and call the URL like below format
var myRequest = new Request(url,“GET”,headers);
var exchange = httpClient.send(myRequest);
But call is failing
I got the below error from trace log
{“headers”:{“Connection”:“keep-alive”,“Content-Length”:“0”,“Date”:“Thu, 12 Jan 2017 10:06:22 GMT”,“Server”:“Apigee LB”,“WWW-Authenticate”:“Basic realm="organizations/rssoftwarestaging/apps/a937ece1-a0be-4475-bfea-e11fdeb279c6"”},“content”:“”,“status”:{“message”:“Unauthorized”,“code”:“401”}}
Please suggest me the correct way to set the header.
Regards,
Suvojit