I have received a api from client and when I am trying to integrate it with angular service, getting 401 unauthorized error
. But same is working with POSTMAN. Please suggest me if I am doing anything wrong.
Here is the code which I am trying:
$http({
url:"https://xxx_test.com/data?sdate=date",
method:"GET",
headers:{'apikey':'key'},})
This is the response that I am getting :
{"fault":{"faultstring":"Failed to resolve API Key variable request.header.apikey","detail":{"errorcode":"steps.oauth.v2.FailedToResolveAPIKey"}}}
Console log:
angular.js:12265 OPTIONS apiurl?start_date=04/26/2018&end_date=04/26/2018 401 (Unauthorized) :3000/#/pos:1 Failed to load apiurl?start_date=04/26/2018&end_date=04/26/2018: Response for preflight has invalid HTTP status code 401.
,I have received a api from client and when I am trying to integrate it with angular service, getting 401 unauthorized error
. But same is working with POSTMAN. Please suggest me if I am doing anything wrong.
Here is the code which I am trying:
$http({
url:"https://xxx_test.com/data?sdate=date",
method:"GET",
headers:{'apikey':'key'}})
This is the response that I am getting :
{"fault":{"faultstring":"Failed to resolve API Key variable request.header.apikey","detail":{"errorcode":"steps.oauth.v2.FailedToResolveAPIKey"}}}
Console log:
angular.js:12265 OPTIONS apiurl?start_date=04/26/2018&end_date=04/26/2018 401 (Unauthorized) :3000/#/pos:1 Failed to load apiurl?start_date=04/26/2018&end_date=04/26/2018: Response for preflight has invalid HTTP status code 401.
Solved! Go to Solution.
Hi @sandeep pandey,
Even I had come across with the same issue recently ,can you just try enabling the CORS in Apigee.
Please follow the steps from the below link.
https://community.apigee.com/questions/22/apigee-pre-flight-options-requests.html