From 45767b87fd7bf0efd05abeb9529ed6167c34b588 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Tue, 12 Aug 2025 19:08:23 -0700 Subject: [PATCH] Fix usage endpoint call using oauth token instead of saved refresh token (#5483) * Fix usage endpoint call using oauth token instead of saved refresh token * Create odd-ladybugs-punch.md * Update src/api/providers/cline.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .changeset/odd-ladybugs-punch.md | 5 +++++ src/api/providers/cline.ts | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/odd-ladybugs-punch.md diff --git a/.changeset/odd-ladybugs-punch.md b/.changeset/odd-ladybugs-punch.md new file mode 100644 index 00000000..b735f558 --- /dev/null +++ b/.changeset/odd-ladybugs-punch.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Fix issue where fallback request to retrieve cost was not using correct auth token diff --git a/src/api/providers/cline.ts b/src/api/providers/cline.ts index b65911a9..43f831cb 100644 --- a/src/api/providers/cline.ts +++ b/src/api/providers/cline.ts @@ -172,10 +172,13 @@ export class ClineHandler implements ApiHandler { try { // TODO: replace this with firebase auth // TODO: use global API Host - + const clineAccountAuthToken = await this._authService.getAuthToken() + if (!clineAccountAuthToken) { + throw new Error(CLINE_ACCOUNT_AUTH_ERROR_MESSAGE) + } const response = await axios.get(`${this.clineAccountService.baseUrl}/generation?id=${this.lastGenerationId}`, { headers: { - Authorization: `Bearer ${this.options.clineAccountId}`, + Authorization: `Bearer ${clineAccountAuthToken}`, }, timeout: 15_000, // this request hangs sometimes })