Files
social-media/src/Web/Endpoints/Google.cs
2024-05-01 18:15:52 -04:00

24 lines
658 B
C#

using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Google;
namespace Hutopy.Web.Endpoints;
public class Google : EndpointGroupBase
{
public override void Map(WebApplication app)
{
app.MapGroup(this)
.MapGet("/o/sign-in", Callback);
}
private static async Task Callback(ISender sender, HttpContext context)
{
await context.ChallengeAsync(GoogleDefaults.AuthenticationScheme,
new AuthenticationProperties
{
RedirectUri = "/signin-google",
ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30),
});
}
}