public sealed class OAuthToken : IMessage<OAuthToken>, IEquatable<OAuthToken>, IDeepCloneable<OAuthToken>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Tasks v2 API class OAuthToken.
Contains information needed for generating an
OAuth token.
This type of authorization should generally only be used when calling Google
APIs hosted on *.googleapis.com.
Service account email
to be used for generating OAuth token.
The service account must be within the same project as the queue. The
caller must have iam.serviceAccounts.actAs permission for the service
account.
[[["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\u003eThis document provides reference information for the \u003ccode\u003eOAuthToken\u003c/code\u003e class within the Google Cloud Tasks v2 API for .NET.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eOAuthToken\u003c/code\u003e contains the necessary data for generating OAuth tokens, typically for use with Google APIs hosted on *.googleapis.com.\u003c/p\u003e\n"],["\u003cp\u003eThe class is an implementation of several interfaces including \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 latest version of the \u003ccode\u003eOAuthToken\u003c/code\u003e class is 3.5.0, and earlier versions from 3.4.0 down to 2.2.0 are also documented.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOAuthToken\u003c/code\u003e class has properties for setting the \u003ccode\u003eScope\u003c/code\u003e and \u003ccode\u003eServiceAccountEmail\u003c/code\u003e to define the OAuth token characteristics.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Tasks v2 API - Class OAuthToken (3.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.5.0 (latest)](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2.OAuthToken)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.4.0/Google.Cloud.Tasks.V2.OAuthToken)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.3.0/Google.Cloud.Tasks.V2.OAuthToken)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.2.0/Google.Cloud.Tasks.V2.OAuthToken)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.1.0/Google.Cloud.Tasks.V2.OAuthToken)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/3.0.0/Google.Cloud.Tasks.V2.OAuthToken)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/2.5.0/Google.Cloud.Tasks.V2.OAuthToken)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/2.4.0/Google.Cloud.Tasks.V2.OAuthToken)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/2.3.0/Google.Cloud.Tasks.V2.OAuthToken)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Tasks.V2/2.2.0/Google.Cloud.Tasks.V2.OAuthToken) \n\n public sealed class OAuthToken : IMessage\u003cOAuthToken\u003e, IEquatable\u003cOAuthToken\u003e, IDeepCloneable\u003cOAuthToken\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Tasks v2 API class OAuthToken.\n\nContains information needed for generating an\n[OAuth token](https://developers.google.com/identity/protocols/OAuth2).\nThis type of authorization should generally only be used when calling Google\nAPIs hosted on \\*.googleapis.com. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e OAuthToken \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[OAuthToken](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2.OAuthToken), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[OAuthToken](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2.OAuthToken), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[OAuthToken](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2.OAuthToken), [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.Tasks.V2](/dotnet/docs/reference/Google.Cloud.Tasks.V2/latest/Google.Cloud.Tasks.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Tasks.V2.dll\n\nConstructors\n------------\n\n### OAuthToken()\n\n public OAuthToken()\n\n### OAuthToken(OAuthToken)\n\n public OAuthToken(OAuthToken other)\n\nProperties\n----------\n\n### Scope\n\n public string Scope { get; set; }\n\nOAuth scope to be used for generating OAuth access token.\nIf not specified, \"\u003chttps://www.googleapis.com/auth/cloud-platform\u003e\"\nwill be used.\n\n### ServiceAccountEmail\n\n public string ServiceAccountEmail { get; set; }\n\n[Service account email](https://cloud.google.com/iam/docs/service-accounts)\nto be used for generating OAuth token.\nThe service account must be within the same project as the queue. The\ncaller must have iam.serviceAccounts.actAs permission for the service\naccount."]]