diff --git a/src/Web/Endpoints/Google.cs b/src/Web/Endpoints/Google.cs index 274426c..640ac44 100644 --- a/src/Web/Endpoints/Google.cs +++ b/src/Web/Endpoints/Google.cs @@ -16,7 +16,7 @@ public class Google : EndpointGroupBase await context.ChallengeAsync(GoogleDefaults.AuthenticationScheme, new AuthenticationProperties { - RedirectUri = "/o/google/callback", + RedirectUri = "/signin-google", ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30), }); } diff --git a/src/Web/Program.cs b/src/Web/Program.cs index 1b712f9..0c0b449 100644 --- a/src/Web/Program.cs +++ b/src/Web/Program.cs @@ -52,12 +52,8 @@ builder.Services.AddInfrastructureServices(builder.Configuration); builder.Services.AddWebServices(); // OAuth -builder.Services.AddAuthentication(options => - { - options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; - options.DefaultChallengeScheme = GoogleDefaults.AuthenticationScheme; - }) - .AddCookie(options => +builder.Services.AddAuthentication() + .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme,options => { options.Cookie.Name = "Hutopy"; options.Cookie.SecurePolicy = builder.Environment.IsDevelopment() ? CookieSecurePolicy.None : CookieSecurePolicy.Always; @@ -70,7 +66,7 @@ builder.Services.AddAuthentication(options => { options.ClientId = builder.Configuration["Google:ClientId"] ?? throw new ArgumentNullException("The Google ClientId is missing."); options.ClientSecret = builder.Configuration["Google:ClientSecret"] ?? throw new ArgumentNullException("The Google ClientSecret is missing."); - options.CallbackPath = "/o/google/callback"; + options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.Events.OnRedirectToAuthorizationEndpoint = context => { context.Response.Redirect(context.RedirectUri + "&prompt=consent");