0

Angular version is 1.3.13

I'm making a url request to a public url to get some data. For one url it functions but for the other it does not. I have no control over the server side.

The URL returns with 200 but AngularJS passes it to the error function. In my browser console the data is there, as JSON, but I do not have access to it in Angular. I was thinking it might the the http.get calling something before passing the data on.

I've tried with plain $http and a custom transformResponse but it still falls to the error of the custom response.

This is the URL:

https://uatmerchant.sixdots.be/oidc/.well-known/openid-configuration

These are the response headers from the URL:

Connection  
close
Content-Security-Policy 
reflected-xss block
Content-Type    
application/json
Date    
Mon, 15 Jan 2018 12:33:30 GMT
Set-Cookie  
BIGipServer~DMZ~pool_uat_5000=…omain=.uatmerchant.sixdots.be
Strict-Transport-Security   
max-age=15552000; includeSubDomains
Transfer-Encoding   
chunked
X_CORRELATION_ID    
UAT-MER-F5-20180115133330632
X-Content-Security-Policy   
reflected-xss block
X-Content-Type-Options  
nosniff
X-Frame-Options 
SAMEORIGIN
X-Xss-Protection    
1; mode=block

This is part of the data that is in the response in the browser console

request_parameter_supported true
claims_parameter_supported  false
scopes_supported    […]
0   openid
1   profile
2   email
3   address
4   phone
issuer  https://uatmerchant.sixdots.be/oidc
acr_values_supported    […]
0   tag:sixdots.be,2016-06:acr_basic

Here is the code making the call with the URL that is detailed at the start of this post above

var oohahhel = $sce.trustAsResourceUrl(urlVar);
$http.get(oohahhel)
    .then(
        function success(response){
            var jsonResponse = angular.fromJson(response);
            //process response
        }
        ,function error(reason){
            //process error
    });
Community
  • 1
  • 1
Gurnard
  • 1,773
  • 22
  • 43
  • what is the message the error function gives you? – Kaddath Jan 15 '18 at 10:34
  • 1
    Is it shows "Access-Control-Allow-Origin" error in your console? – Zahidur Rahman Jan 15 '18 at 10:40
  • Possible duplicate of [AngularJS: No "Access-Control-Allow-Origin" header is present on the requested resource](https://stackoverflow.com/questions/29547003/angularjs-no-access-control-allow-origin-header-is-present-on-the-requested-r) – lin Jan 15 '18 at 10:46
  • 1
    If shows "Access-Control-Allow-Origin" problem server side need to whitelist on your domain. – Zahidur Rahman Jan 15 '18 at 10:47
  • No that is not the error. The argument in the error function is this when printed: {"data":null,"status":0,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":{},"headers":{"Accept":"application/json, text/plain, */*"},"cached":false},"statusText":""} – Gurnard Jan 15 '18 at 12:34
  • You need to add the part of your code where you're actually calling the `$http.get`, since the url in the response is `{}`. Are you sure you're calling the `$http` correctly? – cst1992 Jan 15 '18 at 12:40
  • what angular version are you using? – neptune Jan 15 '18 at 12:55
  • it may be a cors related server side problem: https://stackoverflow.com/questions/43292481/getting-the-response-as-datanull-status-1-when-calling-web-api-from-angula – neptune Jan 15 '18 at 13:05
  • @neptune We are currently using 1.3.13 of Angular Also it works for this URL: https://accounts.google.com/.well-known/openid-configuration It only fails on the URL provided in the post. Data is received by the browser, that is not the issue, the issue that Angular will not let me access the data. – Gurnard Jan 15 '18 at 13:39

0 Answers0