@using System.Security.Claims;
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}
Google.Apis.Auth.AspNetCore3 sample - Index
Google.Apis.Auth.AspNetCore3 sample - Index
The following links showcase some of the features provided by Google.Apis.Auth.AspNetCore3
@if (User.Identity.IsAuthenticated)
{
Logout - You are currently logged in as @User.FindFirst(ClaimTypes.GivenName)?.Value.
}
else
{
Login - You are not currently logged in.
}
List current scopes - List all scopes
this application is currently authorized for.
- Authentication will trigger if there's no authenticated user.
- This shows how to require authentication without any specific scopes.
List Google Drive files - Use the Google Drive API to list some of the files
that the logged user owns.
- Authentication will trigger if there's no authenticated user.
- If a user is already authenticated but hasn't granted the required scopes, incremental authorization will trigger.
- This shows how to do incremental authorization via attributes, and how to use the user's credential to access a Google API.
List Calendars - Use the Calendar API to list some of the calendars
that the logged user has access to.
- Authentication will trigger if there's no authenticated user.
- If a user is already authenticated but hasn't granted the required scopes, incremental authorization will trigger.
- This shows how to do incremental authorization via code, and how to use the user's credential to access a Google API.
Show OAuth tokens related information
- Authentication will trigger if there's no authenticated user.
- This shows how to inspect OAuth token related information.
Force access token refresh
- Authentication will trigger if there's no authenticated user.
- This shows how to force OAuth access token refresh.
You usually don't need to do this since Google.Apis.Auth.AspNetCore3 will
automatically refresh the access token when it's close to expiry.