Interface ITokenAccess
Allows direct retrieval of access tokens to authenticate requests. This is necessary for workflows where you don't want to use Google.Apis.Services.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
Syntax
public interface ITokenAccess
Methods
GetAccessTokenForRequestAsync(string, 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.
Declaration
Task<string> GetAccessTokenForRequestAsync(string authUri = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | authUri | The URI the returned token will grant access to. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<string> | The access token. |