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-17 UTC."],[[["This webpage details the `AnonymousCredentials` class within the Google Cloud C++ client library, specifically for versions 2.11.0 through 2.37.0-rc."],["`AnonymousCredentials` are useful for testing environments without authentication or for accessing publicly readable resources like Google Cloud Storage objects with \"allUsers\" permissions."],["The `AuthorizationHeader()` function in this class will always return an empty string, differing from other `Credentials` types."],["The methods `SignBlob`, `AccountEmail`, and `KeyId` are available within this class, but using unified credentials from the [Authentication Components](https://cloud.google.com/cpp/docs/reference/common/latest/group__guac.html) is the preferred method as noted in the documentation."],["The latest version available is 2.37.0-rc, and the information in this documentation pertains to Anonymous Credentials for C++ Storage."]]],[]]