Interface ITokenAccess (1.60.0)

public interface ITokenAccess

Allows direct retrieval of access tokens to authenticate requests. This is necessary for workflows where you don't want to use BaseClientService to access the API. (e.g. gRPC that implemenents the entire HTTP2 stack internally).

Namespace

GoogleApisAuthOAuth2

Assembly

Google.Apis.Auth.dll

Methods

GetAccessTokenForRequestAsync(string, CancellationToken)

Task<string> GetAccessTokenForRequestAsync(string authUri = null, CancellationToken cancellationToken = default)

Gets an access token to authorize a request. Implementations should handle automatic refreshes of the token if they are supported. The authUri might be required by some credential types (e.g. the JWT access token) while other credential types migth just ignore it.

Parameters
Name Description
authUri string

The URI the returned token will grant access to.

cancellationToken CancellationToken

The cancellation token.

Returns
Type Description
Taskstring

The access token.

Extension Method