Add legacy Foundry GitHub callback route

This commit is contained in:
Nathan Flurry 2026-03-12 19:20:34 -07:00
parent cdac0aa937
commit 436eb4a3a3

View file

@ -143,7 +143,7 @@ export async function startBackend(options: BackendStartOptions = {}): Promise<v
return Response.redirect(result.url, 302);
});
app.get("/api/rivet/app/auth/github/callback", async (c) => {
const handleGithubAuthCallback = async (c: any) => {
const code = c.req.query("code");
const state = c.req.query("state");
if (!code || !state) {
@ -152,7 +152,10 @@ export async function startBackend(options: BackendStartOptions = {}): Promise<v
const result = await appWorkspaceAction(async (workspace) => await workspace.completeAppGithubAuth({ code, state }));
c.header("x-foundry-session", result.sessionId);
return Response.redirect(result.redirectTo, 302);
});
};
app.get("/api/rivet/app/auth/github/callback", handleGithubAuthCallback);
app.get("/api/auth/callback/github", handleGithubAuthCallback);
app.post("/api/rivet/app/sign-out", async (c) => {
const sessionId = await resolveSessionId(c);