Interface IGoogleAuthProvider (1.60.0)

public interface IGoogleAuthProvider

Provides access to Google auth credentials and scopes.

Namespace

GoogleApisAuthAspNetCore3

Assembly

Google.Apis.Auth.AspNetCore3.dll

Methods

GetCredentialAsync(TimeSpan?, CancellationToken)

Task<GoogleCredential> GetCredentialAsync(TimeSpan? accessTokenRefreshWindow = null, CancellationToken cancellationToken = default)

Get a GoogleCredential for the current user. This is a short-term non-refreshable credential; do not store it for later use.

Parameters
NameDescription
accessTokenRefreshWindowTimeSpan

Optional. The duration that must be remaining on the oauth access token. If not specified then will use the default of 5 minutes.

cancellationTokenCancellationToken

Optional. Token to allow cancellation.

Returns
TypeDescription
TaskGoogleCredential

GetCurrentScopesAsync()

Task<IReadOnlyList<string>> GetCurrentScopesAsync()

Get the currently authorized Google scopes.

Returns
TypeDescription
TaskIReadOnlyListstring

A list of all currently authorized Google scopes.

RequireScopesAsync(params string[])

Task<IActionResult> RequireScopesAsync(params string[] scopes)

Get a suitable auth challenge if any of the requested scopes are not yet authorized.

Parameter
NameDescription
scopesstring

The required scopes.

Returns
TypeDescription
TaskIActionResult

An auth challenge if any of the requested scopes are not yet authorized; a Task with a result of null otherwise.

Extension Method