http - AngularJS / OAuth 2 transport-layer security -


the oauth service trying response working wrong in code not make request.

$http.post(myurl, 'grant_type=password&username=' + username + '&password=' + password,     headers: { 'content-type: application/x-www-form-urlencoded', 'authorization basic ' + btoa(secretword) }).         success(function (response) {             console.log(response);         }).         error(function (response) {             console.log(response);         }); 

you have syntax error, therefore js wont make http post request, try this:

$http.post(myurl, 'grant_type=password&username=' + username + '&password=' + password,     { headers: { 'content-type': 'application/x-www-form-urlencoded', 'authorization': 'basic ' + btoa(secretword) } }).         success(function (response) {             console.log(response.data);         }).         error(function (response) {             console.log(response.status);         }); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -