Skip to content

reuse access token to avoid some unnecessary round trips to google site #29

@c0b

Description

@c0b

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

  1. https://github.com/ShinyAds/node-google-dfp/blob/master/lib/DfpUser.js#L120
  2. https://github.com/google/google-auth-library-nodejs/blob/master/lib/auth/oauth2client.js#L189-L195

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions