public interface IGoogleAuthProvider
Provides access to Google auth credentials and scopes.
Namespace
GoogleApisAuthAspNetCore3Assembly
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 | |
---|---|
Name | Description |
accessTokenRefreshWindow |
TimeSpan Optional. The duration that must be remaining on the oauth access token. If not specified then will use the default of 5 minutes. |
cancellationToken |
CancellationToken Optional. Token to allow cancellation. |
Returns | |
---|---|
Type | Description |
TaskGoogleCredential |
GetCurrentScopesAsync()
Task<IReadOnlyList<string>> GetCurrentScopesAsync()
Get the currently authorized Google scopes.
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
scopes |
string The required scopes. |
Returns | |
---|---|
Type | Description |
TaskIActionResult |
An auth challenge if any of the requested scopes are not yet authorized; a Task with a result of null otherwise. |