Skip to content

Commit

Permalink
Includes all information from the oath2 error response in the error m…
Browse files Browse the repository at this point in the history
…essage (#1191)

Co-authored-by: Normal Gaussian <gitlab.march.2019@normal-gaussian.com>
  • Loading branch information
eoingroat and Normal Gaussian committed Sep 28, 2020
1 parent e3055c4 commit 1787f22
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/xoauth2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,15 @@ class XOAuth2 extends Stream {
);

if (data.error) {
return callback(new Error(data.error));
// Error Response : https://tools.ietf.org/html/rfc6749#section-5.2
let errorMessage = data.error;
if(data.error_description) {
errorMessage += ': ' + data.error_description;
}
if(data.error_uri) {
errorMessage += ' (' + data.error_uri + ')';
}
return callback(new Error(errorMessage));
}

if (data.access_token) {
Expand Down

0 comments on commit 1787f22

Please sign in to comment.