nraboy / ng-cordova-oauth

AngularJS oauth library for use with Apache Cordova projects
https://www.thepolyglotdeveloper.com
MIT License
456 stars 199 forks source link

some providers are mangling $http's default content-type #265

Closed amit777 closed 8 years ago

amit777 commented 8 years ago

Our app makes extensive use of $http and it defaults to application/json. When a user tries to login with AzureAD, the following code will override the default header and cause things to mess up.

in oauth.azuread.js:

  $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

Rather than set the global header, I have only set it on the specific request like so:

$http({
  method: "post",
 headers: {'Content-Type': 'application/x-www-form-urlencoded'},
...
});

I noticed a bunch of other OAuth providers seem to have the same issue. I'll try to update them all and do a pull request.

amit777 commented 8 years ago

Hi, I updated the pull request to point to the development branch. (I'm not the most skilled with GitHub, so I hope I've done it correctly).

nraboy commented 8 years ago

PR https://github.com/nraboy/ng-cordova-oauth/pull/267 is pending due to errors in the Travis CI tests.

santekotturi commented 8 years ago

looks like the PR was merged in dev. is there an estimate for when these changes will be merged to master and released?

just spent the evening trying to figure out why after using a new oauth service, the rest of my http calls were being mangled.

nraboy commented 8 years ago

I usually merge the development branch on the weekend. I like to do it when I know I'll have time to troubleshoot, should things not work. I have no doubt that these changes will work flawlessly. Just more of a personal habit.

Thanks for being patient.

Best,

nraboy commented 8 years ago

This is now in version 0.2.10. Thanks for being patient :-)