Skip to content

Commit

Permalink
Merge pull request #3 from facascante/patch-1
Browse files Browse the repository at this point in the history
changes to handle statusCode 400 bad request error
  • Loading branch information
fraxedas committed Dec 13, 2017
2 parents d5a1ce6 + d443dc7 commit bf28a96
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,19 @@
oauth.request.post(options, function (error, response, body) {
if (!error && response.statusCode < 400 && body.refresh_token && body.access_token) {
next(null, body);
}else{
}
else if(response && response.statusCode >= 400){
if(response.body){
next(response.body);
}
else{
next(response);
}
}
else{
next(error, null);
}
});
};

})(module.exports);
})(module.exports);

0 comments on commit bf28a96

Please sign in to comment.