You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OAuth2Client.getToken returns empty error, no token #350
Hi, I am trying to get the access_token using the OAuth2Client's getToken method.
var oauth2Client = new OAuth2(clientID, clientSecret);
oauth2Client.getToken(authCode, function (err, tokens) {
console.log(JSON.stringify(err), tokens);
}
This was to happen as I have been testing this with the same code. However, this error message was not reaching the original callback. This is because of the line:
//Transporter.js, line 76
if (body && body.error) {
// handle single request errors
err = new Error(body.error.message);
err.code = body.error.code;
body = null;
}
As you can see, the error object returned does not match the one this code expects.
Activity
akashgupta88 commentedon Jan 16, 2015
I tried logging the response in the wrapCallback_ method in transporter.js.
And the body was logged as:
This was to happen as I have been testing this with the same code. However, this error message was not reaching the original callback. This is because of the line:
As you can see, the error object returned does not match the one this code expects.
akashgupta88 commentedon Jan 16, 2015
This issue has been resolved with pull request #351
stephen commentedon Jan 16, 2015
Well, still pending review/merge, but glad that I'm not the only one who ran into this 😄.
ryanseys commentedon Jan 19, 2015
@akashgupta88 Released the fix in v1.1.1 available now on npm.
FahadTariq476-dev commentedon Oct 28, 2020
my token.js showing null what i am doing wrong???