Skip to content
Browse files

fix auth request Content-Type header

  • Loading branch information...
1 parent 6435887 commit 8e15431d20c4da4268f5a2a61c2a0b46ed2f2c64 @mervync mervync 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 8e15431

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