fix: redirect to Logto end-session endpoint on logout
After revoking the local session, redirect to Logto's /session/end so the OIDC session is cleared too. Previously redirected to /login which immediately re-authenticated via the still-valid Logto session. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -99,7 +99,14 @@ app.get("/login", oidcAuthMiddleware(), async (c) => c.redirect("/"));
|
|||||||
app.get("/callback", async (c) => processOAuthCallback(c));
|
app.get("/callback", async (c) => processOAuthCallback(c));
|
||||||
app.get("/logout", async (c) => {
|
app.get("/logout", async (c) => {
|
||||||
await revokeSession(c);
|
await revokeSession(c);
|
||||||
return c.redirect("/login");
|
const issuer = process.env.OIDC_ISSUER;
|
||||||
|
const postLogoutRedirect = new URL("/", c.req.url).origin;
|
||||||
|
if (issuer) {
|
||||||
|
return c.redirect(
|
||||||
|
`${issuer}/session/end?post_logout_redirect_uri=${encodeURIComponent(postLogoutRedirect)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return c.redirect("/");
|
||||||
});
|
});
|
||||||
|
|
||||||
// CORS for OAuth and MCP endpoints (required for claude.ai browser-based flows)
|
// CORS for OAuth and MCP endpoints (required for claude.ai browser-based flows)
|
||||||
|
|||||||
Reference in New Issue
Block a user