Skip to content

Add API Key credentials factory function #14759

@dbolduc

Description

@dbolduc

Background

In #14733, we added a public option ApiKeyOption. On second thought, we think we would rather have a credentials factory function:

std::shared_ptr<Credentials> MakeApiKeyCredentials(std::string api_key, Options o = {});

This disallows configurations where ApiKeyOption and UnifiedCredentialsOption are set simultaneously (which is good, because the configuration is invalid).

Work

We need to:

  • Update the sample to use other types (GrpcCredentialOption + CustomMetadataOption) than ApiKeyOption.
    • The existing sample is already published to cloud docs.
    • I do not want to remove it. That would be annoying.
  • Remove ApiKeyOption and all code downstream of it. Almost none of this is salvageable.
    • After this, we can say the release is unblocked.
  • Expand oauth2_internal::Credentials to allow for API keys.
    • This might look like a std::string ApiKey()
    • or it might look like a StatusOr<std::pair<std::string, std::string>> AuthHeader()
  • Add an ApiKeyConfig credential type and do a lot of plumbing.
    • Unified gRPC credentials
    • Unified REST credentials
  • Add MakeApiKeyCredentials(...)

Metadata

Metadata

Assignees

Labels

type: cleanupAn internal cleanup or hygiene concern.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions