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."],[[["The webpage details the `AnonymousCredentials` class, which represents \"anonymous\" Google OAuth2.0 credentials for the C++ library."],["`AnonymousCredentials` are primarily useful for testing or accessing publicly readable Google Cloud Storage resources without needing authentication."],["The class provides methods like `AuthorizationHeader`, which always returns an empty string, and `SignBlob`, which attempts to sign a blob, however it is deprecated."],["Several past versions of the library, ranging from 2.11.0 to 2.37.0-rc, are documented, showing the evolution of `AnonymousCredentials`."],["The methods `AccountEmail` and `KeyId` are available to retrieve account-specific information related to the credentials, but they are deprecated in favor of using the unified credentials documented in the Authentication Components."]]],[]]