2

I'm trying to get a Rest service with angular:

angular.module('coursExoApp').factory('serviceAjax', function ($http) {
return{
    objects: function(){
         var test=$http({
            method: 'GET',
            url: 'http://------------/Windchill/servlet/rest/changes/objects/getReports',
            headers: {
                'Authorization': 'Basic d2NhZG1pbjp3Y2FkbWlu'           
            }
            }).
            success(function(data, status, headers, config) {
                console.log('success');
            }).
            error(function(data, status, headers, config) {
                console.log(config);
            });

            return test;
    }
}});

and i'm getting this error: IMAGE HERE

The service with basic authentification works fine with postMan. thanks for help

Anas Bennis
  • 35
  • 1
  • 9

1 Answers1

1

Sounds like an issue with CORS, perhaps you need to modify the service to allow the origin of the request (Domain your app is running from) ?

Chrome v37/38 CORS failing (again) with 401 for OPTIONS pre-flight requests

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

Community
  • 1
  • 1
Daniel Dawes
  • 975
  • 5
  • 16