0

I am new to angularjs. I am trying to make a REST API request that requires WSSE authorization. I have included it in the header of the request, but it is still not working. Any advice?
sectorProvider.js

var defer = $q.defer();
this.getSectors = function () {
    $http({
        url: 'http://localhost/webapp/web/app_dev.php/api/sectors',
        method: 'GET',
        headers: {
            'Authorization': 'WSSE profile="UsernameToken"',
            'Accept-Language': 'fr',
            'Content-Type': 'application/json',
            'x-wsse': 'UsernameToken Username="superadmin", PasswordDigest="ey69TSz06CUfb3inNS1gWl5/CQM=", Nonce="MTEyZGEwN2ZkN2ZjNzczZg==", Created="2016-05-31T11:05:25Z"'
        }
    })
            .then(function (response) {
                defer.resolve(response.data);
            }, function (response) {
                defer.reject(response);
            });
    return defer.promise;
};  

Request
enter image description here enter image description here

Response
enter image description here

Taieb Baccouch
  • 75
  • 3
  • 12
  • Have you confirmed that your API endpoints are working correctly? That is, that requests are actually being received? – Sylvan D Ash May 31 '16 at 12:24
  • @SylvanDAsh Yes. I tested it with this chrome extension (https://chrome.google.com/webstore/detail/rest-console/cokgbflfommojglbmbpenpphppikmonn) and I used this tool http://www.teria.com/~koseki/tools/wssegen/) to generate WSSE headers. – Taieb Baccouch May 31 '16 at 12:49
  • I use `Postman REST Client`. Anyway, I suggest you first disable the authentication on the API side and see if the request still works. Keep the authentication headers on the request though – Sylvan D Ash May 31 '16 at 12:55
  • @SylvanDAsh I Disabled the WSSE authentification and still the same error. When I removed the custom headers, it works perfectly. – Taieb Baccouch May 31 '16 at 13:06
  • It seems like the headers might be the problem. Sadly HTTP headers are not my forte – Sylvan D Ash May 31 '16 at 13:16

0 Answers0