0

We have a simple auth2 applciation (like this) that works, when called from CURL, but we have a problem getting the token from angular http

So the question is: what is the equivalent of this curl in angular:

curl -H "Accept: application/json" my-client-with-secret:secret@localhost:8080/oauth/token -d grant_type=client_credentials

We tried to set the Authorization header $http.defaults.headers.common['Authorization'] = "Basic <'secret:secret' in Base64>";

but we got 401 unauthorized

Evgeni Dimitrov
  • 21,976
  • 33
  • 120
  • 145
  • Have you seen http://olefriis.blogspot.co.at/2014/01/http-basic-authentication-in-angularjs.html or http://www.jasonwatmore.com/post/2014/05/26/AngularJS-Basic-HTTP-Authentication-Example.aspx ? – derkoe Apr 21 '15 at 14:20
  • Possible duplicate of [How do I get basic auth working in angularjs?](http://stackoverflow.com/questions/17959563/how-do-i-get-basic-auth-working-in-angularjs) – Paul Sweatte Oct 21 '15 at 14:43

0 Answers0