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
When using multiple accounts simultaneously, the code to refresh the token fails for one of the accounts. The symptom is that request.post() never invokes the callback because it waits forever for the token. I did some debugging and what happens is that the TokenRequest remains in the "pending" state forever. That happens because the authenticate() callback updates the TokenRequest of the other account. I suspect the problem is that "this" and "self" in TokenRequest.prototype.get() refer to different objects. Here's my debugging session:
debug> s
break in node_modules/google-oauth-jwt/lib/token-cache.js:30
28 this._cache[key] = new TokenRequest(this.authenticate, options);
29 }
30 this._cache[key].get(callback);
31 };
32
debug> s
break in node_modules/google-oauth-jwt/lib/token-cache.js:70
68 TokenRequest.prototype.get = function (callback) {
69
70 if (this.status == 'expired') {
71
72 this.status = 'pending';
debug> repl
Press Ctrl + C to leave debug repl
this
{ status: 'expired',
pendingCallbacks: Array(2),
issued: 1568844683750,
duration: 3600000,
token: '[ONE TOKEN]' }
self
{ status: 'completed',
pendingCallbacks: Array(0),
issued: 1568883615083,
duration: 3600000,
token: '[OTHER TOKEN]' }
You can see that "this" and "self" refer to different objects. Subsequently, when authenticate() finishes and invokes the callback, the callback updates the "self" TokenRequest, but the real outstanding TokenRequest (this) remains pending forever.
The text was updated successfully, but these errors were encountered:
When using multiple accounts simultaneously, the code to refresh the token fails for one of the accounts. The symptom is that request.post() never invokes the callback because it waits forever for the token. I did some debugging and what happens is that the TokenRequest remains in the "pending" state forever. That happens because the authenticate() callback updates the TokenRequest of the other account. I suspect the problem is that "this" and "self" in TokenRequest.prototype.get() refer to different objects. Here's my debugging session:
debug> s
break in node_modules/google-oauth-jwt/lib/token-cache.js:30
28 this._cache[key] = new TokenRequest(this.authenticate, options);
29 }
You can see that "this" and "self" refer to different objects. Subsequently, when authenticate() finishes and invokes the callback, the callback updates the "self" TokenRequest, but the real outstanding TokenRequest (this) remains pending forever.
The text was updated successfully, but these errors were encountered: