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"]],[["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 page details the \u003ccode\u003eOidcToken\u003c/code\u003e class, which represents an OIDC token, within the \u003ccode\u003eGoogle.Apis.Auth.OAuth2\u003c/code\u003e namespace, part of the \u003ccode\u003eGoogle.Apis.Auth.dll\u003c/code\u003e assembly.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOidcToken\u003c/code\u003e class inherits from the \u003ccode\u003eObject\u003c/code\u003e class and includes one method, \u003ccode\u003eGetAccessTokenAsync\u003c/code\u003e, which allows the retrieval of an access token for requests, refreshing it if expired.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGetAccessTokenAsync\u003c/code\u003e method accepts an optional \u003ccode\u003eCancellationToken\u003c/code\u003e parameter to manage operation cancellation and returns a \u003ccode\u003eTask<String>\u003c/code\u003e containing the valid access token.\u003c/p\u003e\n"],["\u003cp\u003eThis documentation covers the \u003ccode\u003eOidcToken\u003c/code\u003e 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.\u003c/p\u003e\n"],["\u003cp\u003eThis page uses the \u003ccode\u003eUtilities.ThrowIfNull\u003c/code\u003e method as an extension method.\u003c/p\u003e\n"]]],[],null,[]]