A Credentials type representing "anonymous" Google OAuth2.0 credentials.
This is only useful in two cases: (a) in testing, where you want to access a test bench without having to worry about authentication or SSL setup, and (b) when accessing publicly readable resources (e.g. a Google Cloud Storage object that is readable by the "allUsers" entity), which requires no authentication or authorization.
Constructors
AnonymousCredentials()
Functions
virtual AuthorizationHeader()
While other Credentials subclasses return a string containing an Authorization HTTP header from this method, this class always returns an empty string as its value.
Some Credentials types can locally sign a blob, most often just on behalf of an specific service account. This function returns an error if the credentials cannot sign the blob at all, or if the service account is a mismatch.
Parameters
Name
Description
service_account
SigningAccount const &
string_to_sign
std::string const &
Returns
Type
Description
StatusOr< std::vector< std::uint8_t > >
virtual AccountEmail() const
Return the account's email associated with these credentials, if any.
Returns
Type
Description
std::string
virtual KeyId() const
Return the account's key_id associated with these credentials, if any.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-22 UTC."],[[["This page details the `AnonymousCredentials` class within the Google Cloud C++ client library, specifically for version 2.32.0."],["`AnonymousCredentials` are designed for testing or accessing publicly available resources that do not require authentication, and they are a subclass of `Credentials`."],["The `AuthorizationHeader` function for `AnonymousCredentials` always returns an empty string, as no authorization is needed."],["The functions `SignBlob`, `AccountEmail`, and `KeyId` are available within this class, however they are deprecated, with a recommendation to use the unified credentials within [Authentication Components](https://cloud.google.com/cpp/docs/reference/common/latest/group__guac.html)."],["The page also contains a list of all previous versions of this class, from 2.11.0 to 2.37.0-rc, which is the latest version."]]],[]]