Basic Auth with Ionic and AngularJS?

0

I'm an Android / iOS native developer and now I'm starting to study Ionic for hybrid development. I need to make a connection with a webservice that uses Basic Auth and I'm not finding how to do this, I found some examples with a lot of written code, for example: link and still does not use Basic Auth. I think it's something simple, but I'm not finding it.

How to do this?

    
asked by anonymous 10.11.2015 / 17:29

1 answer

1

Try this:

$http.get('http://myserver.com/api', { headers: {'Authorization': 'Basic '+ base64.encode( username + ':' + password) } })

debugue in Chrome Developer-Tools, Network tab

    
02.12.2015 / 21:05