public static T AddCredential<T>(this T request, ICredential credential)
where T : ClientServiceRequest
Add a credential that is used for this request only.
This will override a service-level credential (if there is one).
Do not call more than once per request instance, as each call incrementally adds the provided credential.
To perform identical requests but with distinct credentials, create a separate request instance for each credential.
Parameters
Name
Description
request
T
The request which requires a credential. Must not be null.
[[["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-03-05 UTC."],[[["This webpage details the `RequestExtensions` class, which provides extension methods for managing requests within the `Google.Apis.Auth.OAuth2` namespace."],["The `RequestExtensions` class inherits from `Object` and includes several inherited members such as `Equals`, `GetHashCode`, and `ToString`."],["A primary function of the `RequestExtensions` class is the `AddCredential\u003cT\u003e` method, which allows for adding a specific credential to an individual request, overriding any service-level credentials."],["The `AddCredential\u003cT\u003e` method accepts two parameters: a request of type `T` and an `ICredential`, both of which must not be null."],["The documentation provided includes versions ranging from 1.50.0 to 1.69.0 of the associated material, with 1.69.0 being the most recent."]]],[]]