mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 09:01:17 +00:00
Fix GitHub OAuth callback by removing retry wrapper
OAuth authorization codes are single-use. The appWorkspaceAction wrapper retries failed calls up to 20 times, but if the code exchange succeeds and a later step fails, every retry sends the already-consumed code, producing "bad_verification_code" from GitHub. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
63df393004
commit
6f8dc26111
1 changed files with 5 additions and 1 deletions
|
|
@ -169,7 +169,11 @@ export async function startBackend(options: BackendStartOptions = {}): Promise<v
|
||||||
if (!code || !state) {
|
if (!code || !state) {
|
||||||
return c.text("Missing GitHub OAuth callback parameters", 400);
|
return c.text("Missing GitHub OAuth callback parameters", 400);
|
||||||
}
|
}
|
||||||
const result = await appWorkspaceAction(async (workspace) => await workspace.completeAppGithubAuth({ code, state }));
|
// Do not use appWorkspaceAction here — OAuth codes are single-use,
|
||||||
|
// so retrying with the same code after a partial failure will always
|
||||||
|
// produce "bad_verification_code".
|
||||||
|
const workspace = await appWorkspace();
|
||||||
|
const result = await workspace.completeAppGithubAuth({ code, state });
|
||||||
c.header("x-foundry-session", result.sessionId);
|
c.header("x-foundry-session", result.sessionId);
|
||||||
return Response.redirect(result.redirectTo, 302);
|
return Response.redirect(result.redirectTo, 302);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue