Skip to content

Commit 93ad078

Browse files
committed
fix(google): remove retired usage token parser
1 parent 9f7c2e1 commit 93ad078

2 files changed

Lines changed: 1 addition & 23 deletions

File tree

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// Google tests cover oauth token shared plugin behavior.
22
import { describe, expect, it } from "vitest";
3-
import {
4-
formatGoogleOauthApiKey,
5-
parseGoogleOauthApiKey,
6-
parseGoogleUsageToken,
7-
} from "./oauth-token-shared.js";
3+
import { formatGoogleOauthApiKey, parseGoogleOauthApiKey } from "./oauth-token-shared.js";
84

95
describe("google oauth token helpers", () => {
106
it("formats oauth credentials with project-aware payloads", () => {
@@ -21,10 +17,6 @@ describe("google oauth token helpers", () => {
2117
expect(formatGoogleOauthApiKey({ type: "token", access: "token-123" })).toBe("");
2218
});
2319

24-
it("parses project-aware oauth payloads for usage auth", () => {
25-
expect(parseGoogleUsageToken(JSON.stringify({ token: "usage-token" }))).toBe("usage-token");
26-
});
27-
2820
it("parses structured oauth payload fields", () => {
2921
expect(
3022
parseGoogleOauthApiKey(JSON.stringify({ token: "usage-token", projectId: "proj-1" })),
@@ -33,8 +25,4 @@ describe("google oauth token helpers", () => {
3325
projectId: "proj-1",
3426
});
3527
});
36-
37-
it("falls back to the raw token when the payload is not JSON", () => {
38-
expect(parseGoogleUsageToken("raw-token")).toBe("raw-token");
39-
});
4028
});

‎extensions/google/oauth-token-shared.ts‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,3 @@ export function formatGoogleOauthApiKey(cred: GoogleOauthApiKeyCredential): stri
3131
projectId: cred.projectId,
3232
});
3333
}
34-
35-
export function parseGoogleUsageToken(apiKey: string): string {
36-
const parsed = parseGoogleOauthApiKey(apiKey);
37-
if (parsed?.token) {
38-
return parsed.token;
39-
}
40-
41-
// Keep the raw token when the stored credential is not a project-aware JSON payload.
42-
return apiKey;
43-
}

0 commit comments

Comments
 (0)