Skip to content
  • Harry Brundage's avatar
    Add support for OAuth credential based authorization · 443bba36
    Harry Brundage authored
    Instead of requiring every user of this tap to set up a service account, it should be possible for users to grant systems access to their analytics data from a nice web ui. We're trying to build something sort of similar to stitch data where users are able to self-serve injest their data from GA, and I imagine eventually Meltano will want to reduce the setup friction for this kind of thing as well. For tap-google-analytics to be useful in these scenarios, it has to be able to authorize it's calls to the Google Analytics APIs with credentials provided by an OAuth flow instead of the hard expectation on a service account. This implements just that!
    
    We add a new key to the configuration with a nested object containing all the keys to properly authenticate using OAuth credentials. This is more than just the `access_token` because the `access_token` can expire. The google API libraries support automatic refreshing of the token, which will allow the tap to continue in the event that a token is expired or expires during a run, but that requires passing in the `refresh_token` and client id/secret pair for the library to use. So, we take those in, provision a different `Credentials` object, and it all just works.
    443bba36