Open c0b opened 8 years ago
@c0b I just ran into the same problem. Could you please make a PR, so this could be merged into the library, too?
Sadly the method getRequestMetadata
isn't officially documented (heck, it's already the "preferred way" to authorize, because .authorize
is already deprecated).
For curious ones I'll just leave this here: https://github.com/google/google-auth-library-nodejs/issues/138
I have played with this library a few days it's working nicely while I noticed when my application need to talk to google for longer tasks, some part of this code is not caching and retrieving some resource again and again, for example google's oauth token has one hour validity by default, so within the hour we can reuse it, only need to refresh it until it's almost expiring, I'm doing some code changes locally to cache and it works better, can make a PR if it's welcome.
btw, google's library says refreshAccessToken is deprecated [2], I have switched to use getRequestMetadata; that is less code because google-auth-library handles token expiry and refresh itself pretty well