Search code examples
rubygoogle-cloud-platformgoogle-oauth

google cloud ruby gem / running commands on behalf of oauth-authenticated user


Getting a bit lost in the diverse documentation endpoints (here, here, to name a few…)

This one is pretty usable for a given account by providing a json key as an environment variable.

The thing is, I just don't see how commands can be run on the behalf of a user authenticated via oauth — practically speaking, where do you specify the oauth user token ?

Thanks for sharing this insight

Best


Solution

  • google-cloud-ruby (which you linked in your question) is designed to provide access via service account credentials, as you noted. For help with "lower-level" access in which you managing your own OAuth tokens, you might consider google-auth-library-ruby. However, if you can use a service account instead of a user account to use the higher-level access provided by google-cloud-ruby, I believe it's probably the best approach, as recommended in Google Cloud Storage Authentication:

    Due to the complexity of managing and refreshing access tokens and the security risk when dealing directly with cryptographic applications, we strongly encourage you to use a verified client library.