Skip to content

Support Application Default Credentials #20

@mwilliammyers

Description

@mwilliammyers

What do you think about supporting Application Default Credentials? To start we could just check GOOGLE_APPLICATION_CREDENTIALS.

Down the road, we could also communicate with the metadata server to automatically obtain credentials if GOOGLE_APPLICATION_CREDENTIALS wasn’t provided. This would obviously be more involved but I think reverse engineering this process from one of the official client libraries wouldn’t be too bad.

So the flow would be:

  1. Try to use an explicitly provided service account.
  2. If None, check GOOGLE_APPLICATION_CREDENTIALS
  3. (Future work) If None, communicate with metadata server to use default service account
  4. If still not found, Err.

This might belong in yup-oauth2 because right now google_api_auth pretty much wraps it, but this might be a little too Google-specific for yup-oauth2?

Maybe we could support this auth flow (which would use yup-oauth2 under the hood) as a sibling to the one provided by the with-yup-oauth2 feature? Honestly, I think this abstracted away flow should be the default and users could opt in to with-yup-oauth2 if they want more control. Although, it would be a little weird that this default feature would depend on yup-oauth2, in addition to the explicit non-default feature depending on it as well...

One of the things I love about GCP (as opposed to AWS etc) is their authentication mechanism. It is so seamless and uniform across all their APIs. This would be a big step towards that UX.

Once we decide on a direction, I would be happy to open a PR.

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