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"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis webpage details the \u003ccode\u003eRequestExtensions\u003c/code\u003e class, which provides extension methods for managing requests within the \u003ccode\u003eGoogle.Apis.Auth.OAuth2\u003c/code\u003e namespace.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRequestExtensions\u003c/code\u003e class inherits from \u003ccode\u003eObject\u003c/code\u003e and includes several inherited members such as \u003ccode\u003eEquals\u003c/code\u003e, \u003ccode\u003eGetHashCode\u003c/code\u003e, and \u003ccode\u003eToString\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eA primary function of the \u003ccode\u003eRequestExtensions\u003c/code\u003e class is the \u003ccode\u003eAddCredential<T>\u003c/code\u003e method, which allows for adding a specific credential to an individual request, overriding any service-level credentials.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAddCredential<T>\u003c/code\u003e method accepts two parameters: a request of type \u003ccode\u003eT\u003c/code\u003e and an \u003ccode\u003eICredential\u003c/code\u003e, both of which must not be null.\u003c/p\u003e\n"],["\u003cp\u003eThe 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.\u003c/p\u003e\n"]]],[],null,[]]