Skip to content
Browse files

Merge pull request #4 from elrohir/master

fix auth request Content-Type header
  • Loading branch information...
2 parents 6435887 + 8e15431 commit e30fa91ed796fb252103eb95287bf394a5e54ca8 @extrabacon committed Feb 17, 2014
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/auth.js
View
10 lib/auth.js
@@ -27,8 +27,7 @@ exports.authenticate = function (options, callback) {
form: {
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
assertion: jwt
- },
- json: true
+ }
}, function (err, res, body) {
if (err) {
@@ -47,6 +46,13 @@ exports.authenticate = function (options, callback) {
return callback(err);
}
+ try {
+ body = JSON.parse(body);
+ }
+ catch (e) {
+ return callback(new Error('failed to parse response body: ' + body));
+ }
+
return callback(null, body.access_token);
});

0 comments on commit e30fa91

Please sign in to comment.
Something went wrong with that request. Please try again.