HTTP Basic Authentication Fails on IOS


#1

Hi guys.

I have trouble making GET requests with basic autentication header …

This is my code .

$ Http.defaults.headers.common [ ' authorization '] = ' Basic ' + base64.encode ( user.username + ' : ' + user.password ) ; $http.get(ENV.apiEndpoint + 'api/token/' + uuid) .success(function (data, status) { alert("success"); if (data.token) { $rootScope.token = data.token; } deferred.resolve(data); }) .error(function (response) { alert("failed"); deferred.resolve(response); });

This code works fine on Android, but iOS does not return any result … (the alerts don’t show never) .

Any suggestions ?


#2

I have the same problem…Any solution?


#3

what data are you receiving?

Check your info.plist for

<key>NSAppTransportSecurity</key>  
<dict>  
    <key>NSAllowsArbitraryLoads</key>
    <true />  
</dict>