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:
7
.changeset/fix-anthropic-oauth-refresh.md
Normal file
7
.changeset/fix-anthropic-oauth-refresh.md
Normal 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.
|
||||||
@@ -484,6 +484,12 @@ describe("createFusionAuthStorage", () => {
|
|||||||
body: expect.not.stringContaining("\"scope\""),
|
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({
|
expect(authStorage.get("anthropic-subscription")).toEqual({
|
||||||
type: "oauth",
|
type: "oauth",
|
||||||
access: "refreshed-subscription-access-token",
|
access: "refreshed-subscription-access-token",
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ async function refreshAnthropicOAuthCredential(credential: StoredCredential): Pr
|
|||||||
// Do not include scope: RFC 6749 refreshes preserve the granted scope only when omitted.
|
// Do not include scope: RFC 6749 refreshes preserve the granted scope only when omitted.
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
grant_type: "refresh_token",
|
grant_type: "refresh_token",
|
||||||
client_id: "9d1c250a-e6a1-44d9-88ed-5944d1962f5e",
|
client_id: "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
|
||||||
refresh_token: credential.refresh,
|
refresh_token: credential.refresh,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user