public Task<string> GetAccessTokenAsync(CancellationToken cancellationToken = null)
Gets the access token that should be included in headers when performing
requests with this OidcToken.
This method will refresh the access token if the current one has expired.
Parameter
Name
Description
cancellationToken
CancellationToken
The cancellation token to use for cancelling the operation.
[[["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-21 UTC."],[[["This page details the `OidcToken` class, which represents an OIDC token, within the `Google.Apis.Auth.OAuth2` namespace, part of the `Google.Apis.Auth.dll` assembly."],["The `OidcToken` class inherits from the `Object` class and includes one method, `GetAccessTokenAsync`, which allows the retrieval of an access token for requests, refreshing it if expired."],["The `GetAccessTokenAsync` method accepts an optional `CancellationToken` parameter to manage operation cancellation and returns a `Task\u003cString\u003e` containing the valid access token."],["This documentation covers the `OidcToken` class from version 1.50.0 and includes links to documentation for this class in newer versions, with the most recent being version 1.69.0."],["This page uses the `Utilities.ThrowIfNull` method as an extension method."]]],[]]