ninjatronic / angular-base64

Base64 conversion for AngularJS
Other
186 stars 113 forks source link

Error while retrieve the data #28

Open BUHARIMOHAMEDISMAIL opened 7 years ago

BUHARIMOHAMEDISMAIL commented 7 years ago

I'm using the below code to retrieve the data.I'm getting an 401 unauthorized error.

    var url = 'https://xxx.yyy.zzz-gtgl.com/obdo/newsfeedinteg';
    var auth = $base64.encode("newsfeed:newsfeed@123"), 
    headers = {"Authorization": "Basic " + auth};
    $http.get(url, {headers: headers}).success(function (resp) {
        console.log(resp);
     }).error(function (err) {
        console.log(err);
    });

When i was checking in postman it's working fine and get the json response. In postman I'm enter the username and password in Basic Auth field which comes under Authorization and content-type as application/json finally send the POST request.

Please assist me.