Copied!

The ApiKeyHeaderCredentials object provides a wrapper around an API key.

CloneableInstantiable
Constants
public Google\Auth\GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER = 'X-Goog-User-Project'
Methods
public __construct(string $apiKey, ?string $quotaProject = NULL)
 

ApiKeyHeaderCredentials constructor.

  • param string $apiKey The API key to set in the header for the request
  • param string|null $quotaProject The quota project associated with the API key.
  • throws \ValidationException
public checkUniverseDomain() : void
 

Verify that the expected universe domain matches the universe domain from the credentials.

  • throws \ValidationException if the universe domain does not match.
public getAuthorizationHeaderCallback(?string $unusedAudience = NULL) : ?callable
 
  • param string|null $unusedAudience audiences are not supported for API keys.
  • return callable|null Callable function that returns the API key header.
public getQuotaProject() : ?string
 
  • return string|null The quota project associated with the credentials.
Properties
private string $apiKey
private ?string $quotaProject
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration