public Task<string> GetAccessTokenAsync(CancellationToken cancellationToken = default)
Gets the access token that should be included in headers when performing
requests with thisOidcToken.
This method will refresh the access token if the current one has expired.
[[["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 \u003ccode\u003eOidcToken\u003c/code\u003e class represents an OpenID Connect (OIDC) token within the \u003ccode\u003eGoogle.Apis.Auth.OAuth2\u003c/code\u003e namespace, found in the \u003ccode\u003eGoogle.Apis.Auth.dll\u003c/code\u003e assembly.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits from the \u003ccode\u003eobject\u003c/code\u003e class and provides access to inherited members like \u003ccode\u003eEquals\u003c/code\u003e, \u003ccode\u003eGetHashCode\u003c/code\u003e, \u003ccode\u003eGetType\u003c/code\u003e, \u003ccode\u003eReferenceEquals\u003c/code\u003e, and \u003ccode\u003eToString\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGetAccessTokenAsync\u003c/code\u003e method retrieves a valid access token, refreshing it if it's expired, and it takes an optional \u003ccode\u003eCancellationToken\u003c/code\u003e for operation cancellation.\u003c/p\u003e\n"],["\u003cp\u003eThe access token obtained from the \u003ccode\u003eGetAccessTokenAsync\u003c/code\u003e method is intended to be used in request headers when interacting with this specific \u003ccode\u003eOidcToken\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAvailable versions for the OidcToken class are 1.69.0, 1.68.0, 1.60.0, 1.59.0, 1.55.0 and 1.50.0 with 1.69.0 being the latest version.\u003c/p\u003e\n"]]],[],null,["# Class OidcToken (1.69.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.69.0 (latest)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.OidcToken)\n- [1.68.0](/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Auth.OAuth2.OidcToken)\n- [1.60.0](/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Auth.OAuth2.OidcToken)\n- [1.59.0](/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Auth.OAuth2.OidcToken)\n- [1.55.0](/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Auth.OAuth2.OidcToken)\n- [1.50.0](/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Auth.OAuth2.OidcToken) \n\n public sealed class OidcToken\n\nRepresents an OIDC Token. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e OidcToken \n\nInherited Members\n-----------------\n\n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \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.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Apis.Auth.OAuth2](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2)\n\nAssembly\n--------\n\nGoogle.Apis.Auth.dll\n\nMethods\n-------\n\n### GetAccessTokenAsync(CancellationToken)\n\n public Task\u003cstring\u003e GetAccessTokenAsync(CancellationToken cancellationToken = default)\n\nGets the access token that should be included in headers when performing\nrequests with this [OidcToken](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.OidcToken).\nThis method will refresh the access token if the current one has expired.\n\nExtension Method\n----------------\n\n[Utilities.ThrowIfNull\\\u003cT\\\u003e(T, string)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)"]]