Closed leefsmp closed 7 years ago
The autoRefresh code is here. As you can see, the autoRefresh will run 300 seconds before the access_token expires and request a new token.
Can we change this line of code by the following, that would allow skipping the oauth2client and provide credentials refreshed by custom logic:
if (oauth2client && oauth2client.autoRefresh && new Date(credentials.expires_at - 300).getTime() <= Date.now()) {
Thanks
@leefsmp, @cyrillef - fixed
Can you show a concrete example using autoRefresh = true? Do my client code needs to pass a callback or can I assume calling
OAuth2TwoLegged.prototype.getCredentials
will always return a valid token? By looking at the implementation it seems to me autoRefresh is not doing anything ...