fix(FN-8142): restore Anthropic OAuth refresh

Use the Claude OAuth client identity issued by the login flow and lock the request contract down with a regression assertion.
This commit is contained in:
gsxdsm
2026-07-17 16:26:20 -07:00
parent 62f121e0c9
commit 703488f0f3
3 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
---
"@runfusion/fusion": patch
---
summary: Keep Anthropic subscription sessions connected by refreshing OAuth credentials with the correct client identity.
category: fix
dev: Corrects the Claude OAuth client ID used by the engine refresh request and adds request-contract coverage.

View File

@@ -484,6 +484,12 @@ describe("createFusionAuthStorage", () => {
body: expect.not.stringContaining("\"scope\""),
}),
);
const refreshRequest = fetchMock.mock.calls[0]?.[1] as RequestInit | undefined;
expect(JSON.parse(String(refreshRequest?.body))).toMatchObject({
grant_type: "refresh_token",
client_id: "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
refresh_token: "subscription-refresh-token",
});
expect(authStorage.get("anthropic-subscription")).toEqual({
type: "oauth",
access: "refreshed-subscription-access-token",

View File

@@ -352,7 +352,7 @@ async function refreshAnthropicOAuthCredential(credential: StoredCredential): Pr
// Do not include scope: RFC 6749 refreshes preserve the granted scope only when omitted.
body: JSON.stringify({
grant_type: "refresh_token",
client_id: "9d1c250a-e6a1-44d9-88ed-5944d1962f5e",
client_id: "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
refresh_token: credential.refresh,
}),
});