Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/api/Program.cs
diff options
context:
space:
mode:
authorLeitwolf2026-10-16 07:15:42 +0300
committerGitHub2026-10-16 07:15:42 +0300
commite140d6587a1a74efc205b29582dfbe9942e0f3dc (patch)
tree2cc8867a56273c910d00855ac1eeac22fdee1bd6 /apps/api/Program.cs
parent3877e3318e875cdebc3d7b9bc970b4496e5183a9 (diff)
parentbc653270652c1ab44d2144ddd17ae49b404e7cd2 (diff)
downloadprogmaweb-e140d6587a1a74efc205b29582dfbe9942e0f3dc.tar.gz
Merge pull request #38 from Progmasoft/fix/stale-statements
Return a failed Google callback to sign-in and correct stale statements
Diffstat (limited to 'apps/api/Program.cs')
-rw-r--r--apps/api/Program.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/api/Program.cs b/apps/api/Program.cs
index 3eb96c9..688fe7d 100644
--- a/apps/api/Program.cs
+++ b/apps/api/Program.cs
@@ -44,6 +44,14 @@ if (!string.IsNullOrWhiteSpace(googleClientId) && !string.IsNullOrWhiteSpace(goo
options.CallbackPath = "/api/v1/accounts/oauth/google/callback";
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;
+ };
});
}
builder.Services.AddProblemDetails();