Interface IGoogleAuthProvider (1.59.0)

public interface IGoogleAuthProvider

Provides access to Google auth credentials and scopes.

Namespace

Google.Apis.Auth.AspNetCore3

Assembly

Google.Apis.Auth.AspNetCore3.dll

Methods

GetCredentialAsync(Nullable<TimeSpan>, CancellationToken)

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

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

Parameters
NameDescription
accessTokenRefreshWindowNullable<TimeSpan>

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
Task<GoogleCredential>

GetCurrentScopesAsync()

Task<IReadOnlyList<string>> GetCurrentScopesAsync()

Get the currently authorized Google scopes.

Returns
TypeDescription
Task<IReadOnlyList<String>>

A list of all currently authorized Google scopes.

RequireScopesAsync(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
Task<IActionResult>

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

Extension Method