Interface ITokenAccess (1.59.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

Google.Apis.Auth.OAuth2

Assembly

Google.Apis.Auth.dll

Methods

GetAccessTokenForRequestAsync(String, CancellationToken)

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

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
NameDescription
authUriString

The URI the returned token will grant access to.

cancellationTokenCancellationToken

The cancellation token.

Returns
TypeDescription
Task<String>

The access token.

Extension Method