Moved back to default redirect uri

This commit is contained in:
Kamigen
2024-05-01 18:15:52 -04:00
parent f9a661c8d2
commit b966e28d9a
2 changed files with 4 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ public class Google : EndpointGroupBase
await context.ChallengeAsync(GoogleDefaults.AuthenticationScheme, await context.ChallengeAsync(GoogleDefaults.AuthenticationScheme,
new AuthenticationProperties new AuthenticationProperties
{ {
RedirectUri = "/o/google/callback", RedirectUri = "/signin-google",
ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30), ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30),
}); });
} }

View File

@@ -52,12 +52,8 @@ builder.Services.AddInfrastructureServices(builder.Configuration);
builder.Services.AddWebServices(); builder.Services.AddWebServices();
// OAuth // OAuth
builder.Services.AddAuthentication(options => builder.Services.AddAuthentication()
{ .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme,options =>
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = GoogleDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{ {
options.Cookie.Name = "Hutopy"; options.Cookie.Name = "Hutopy";
options.Cookie.SecurePolicy = builder.Environment.IsDevelopment() ? CookieSecurePolicy.None : CookieSecurePolicy.Always; 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.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.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 => options.Events.OnRedirectToAuthorizationEndpoint = context =>
{ {
context.Response.Redirect(context.RedirectUri + "&prompt=consent"); context.Response.Redirect(context.RedirectUri + "&prompt=consent");