Skip to content

Asymmetry in handling keyFilename vs. credentials #5

@kjin

Description

@kjin

From the google-cloud README, it's stated that google-cloud can be initialized with either a keyFilename field containing a path to a key file, or a credentials field containing that key file's contents. However, it seems like the behavior when key file is passed in through the keyFilename or the credentials field in the implementation of getAuthClient differs.

  • For key files whose contents are supplied through the credentials field, either a JWTClient or UserRefreshClient is constructed when credentials.type is "service_account" or "authorized_user" respectively.
  • For key files whose paths are referenced through the keyFilename field, a JWTClient is created regardless of its contents.

In the latter case, any key file with the type field as "authorized_user" will cause an error (because it doesn't have a client_email field).

Would it be appropriate to have getAuthClient read the key file when keyFilename exists, and process its contents just as it would if the key file already populated the credentials field?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions