diff options
| author | Leitwolf | 2026-10-16 18:46:35 +0300 |
|---|---|---|
| committer | GitHub | 2026-10-16 18:46:35 +0300 |
| commit | e3c7010328447038291712407142d1d744a5a462 (patch) | |
| tree | 44077b255fdf019e82d6960ba30e70c3a59a954a /apps/api/Program.cs | |
| parent | 8f58831373b72dc5b60bad649a961acd0bb94aa4 (diff) | |
| parent | 031cbf7efc5d97b28259da5b387cb3a3dbd242d5 (diff) | |
| download | progmaweb-e3c7010328447038291712407142d1d744a5a462.tar.gz | |
Merge pull request #40 from Progmasoft/feature/log-google-failures
Log why a Google callback could not finish
Diffstat (limited to 'apps/api/Program.cs')
| -rw-r--r-- | apps/api/Program.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/api/Program.cs b/apps/api/Program.cs index 688fe7d..31b46a2 100644 --- a/apps/api/Program.cs +++ b/apps/api/Program.cs @@ -45,13 +45,12 @@ if (!string.IsNullOrWhiteSpace(googleClientId) && !string.IsNullOrWhiteSpace(goo options.SignInScheme = AccountEndpoints.ExternalCookieScheme; options.SaveTokens = false; // A callback that cannot finish (the visitor declined on Google, or the state cookie is missing or - // expired) would otherwise end in an unhandled 500. The sign-in page explains a failed Google sign-in. - options.Events.OnRemoteFailure = context => - { - context.Response.Redirect("/login?google=failed"); - context.HandleResponse(); - return Task.CompletedTask; - }; + // expired) would otherwise end in an unhandled 500. The cause is logged, and the sign-in page explains + // a failed Google sign-in. + options.Events.OnRemoteFailure = context => GoogleSignInFailure.HandleAsync( + context, + context.HttpContext.RequestServices.GetRequiredService<ILoggerFactory>() + .CreateLogger(typeof(GoogleSignInFailure))); }); } builder.Services.AddProblemDetails(); |