I see that this pull request adds a method to refresh the access token using a saved refresh token. It is not clear to me how to use it. I have saved the tokens (including the refresh token) from the original getToken request and am now retrieving the token from the Database in a new session. How do I set the credentials on OAuth2Client so that I can call refreshAccessToken and get a new accesstoken?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- How to reimport module with ES6 import
- Why is `node.js` dying when called from inside pyt
- How to verify laravel passport api token in node /
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- How to embed Google Speech to Text API in Python p
- Does google-hosted jquery helps google to track vi
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- Is there a google API to read cached content? [clo
- How to resolve hostname to an ip address in node j
I had missed the paragraph on setting credentials on the github readme, so here is some sample code in case anybody else needs it.
Just a guess as I haven't used this library. But it looks to me like you simply call
myOAuth2Client.refreshAccessToken(function(err, newCredentials){})
, where you have already instantiated theOAuth2Client
object with the old token. (dunno how you do that but it might be as simple as instantiating the object thenmyOauth2Client.credentials.refresh_token = 'foobar'
.) And if there's no error, it'll modify theOAuth2Client.credentials
object and additionally pass the credentials object to the callback.