public sealed class OAuthCredential : IMessage<OAuthCredential>, IEquatable<OAuthCredential>, IDeepCloneable<OAuthCredential>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Build v2 API class OAuthCredential.
Represents an OAuth token of the account that authorized the Connection,
and associated metadata.
[[["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-09-04 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eOAuthCredential\u003c/code\u003e class is 1.4.0, and there are also older versions available, including 1.3.0, 1.2.0, 1.1.0, and 1.0.0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eOAuthCredential\u003c/code\u003e is a class that represents an OAuth token and its associated metadata for Cloud Build v2 API, it is a sealed class that implements several interfaces such as \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class has two constructors: a default one, \u003ccode\u003eOAuthCredential()\u003c/code\u003e, and another \u003ccode\u003eOAuthCredential(OAuthCredential other)\u003c/code\u003e that accepts another instance of \u003ccode\u003eOAuthCredential\u003c/code\u003e as a parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides properties like \u003ccode\u003eOauthTokenSecretVersion\u003c/code\u003e to store the SecretManager resource containing the OAuth token, \u003ccode\u003eOauthTokenSecretVersionAsSecretVersionName\u003c/code\u003e which provides a typed view over the resource name, and \u003ccode\u003eUsername\u003c/code\u003e to store the username associated with the token.\u003c/p\u003e\n"],["\u003cp\u003eThis documentation pertains to the \u003ccode\u003eGoogle.Cloud.CloudBuild.V2\u003c/code\u003e namespace found within the \u003ccode\u003eGoogle.Cloud.CloudBuild.V2.dll\u003c/code\u003e assembly.\u003c/p\u003e\n"]]],[],null,["# Cloud Build v2 API - Class OAuthCredential (1.4.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.4.0 (latest)](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/latest/Google.Cloud.CloudBuild.V2.OAuthCredential)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/1.3.0/Google.Cloud.CloudBuild.V2.OAuthCredential)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/1.2.0/Google.Cloud.CloudBuild.V2.OAuthCredential)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/1.1.0/Google.Cloud.CloudBuild.V2.OAuthCredential)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/1.0.0/Google.Cloud.CloudBuild.V2.OAuthCredential) \n\n public sealed class OAuthCredential : IMessage\u003cOAuthCredential\u003e, IEquatable\u003cOAuthCredential\u003e, IDeepCloneable\u003cOAuthCredential\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Build v2 API class OAuthCredential.\n\nRepresents an OAuth token of the account that authorized the Connection,\nand associated metadata. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e OAuthCredential \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[OAuthCredential](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/latest/Google.Cloud.CloudBuild.V2.OAuthCredential), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[OAuthCredential](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/latest/Google.Cloud.CloudBuild.V2.OAuthCredential), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[OAuthCredential](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/latest/Google.Cloud.CloudBuild.V2.OAuthCredential), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.CloudBuild.V2](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/latest/Google.Cloud.CloudBuild.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.CloudBuild.V2.dll\n\nConstructors\n------------\n\n### OAuthCredential()\n\n public OAuthCredential()\n\n### OAuthCredential(OAuthCredential)\n\n public OAuthCredential(OAuthCredential other)\n\nProperties\n----------\n\n### OauthTokenSecretVersion\n\n public string OauthTokenSecretVersion { get; set; }\n\nA SecretManager resource containing the OAuth token that authorizes\nthe Cloud Build connection. Format: `projects/*/secrets/*/versions/*`.\n\n### OauthTokenSecretVersionAsSecretVersionName\n\n public SecretVersionName OauthTokenSecretVersionAsSecretVersionName { get; set; }\n\n[SecretVersionName](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/latest/Google.Cloud.CloudBuild.V2.SecretVersionName)-typed view over the [OauthTokenSecretVersion](/dotnet/docs/reference/Google.Cloud.CloudBuild.V2/latest/Google.Cloud.CloudBuild.V2.OAuthCredential#Google_Cloud_CloudBuild_V2_OAuthCredential_OauthTokenSecretVersion) resource name\nproperty.\n\n### Username\n\n public string Username { get; set; }\n\nOutput only. The username associated to this token."]]