From a501c059691ea39c371fa6e1697441d26fd01a51 Mon Sep 17 00:00:00 2001 From: decolua Date: Tue, 10 Mar 2026 16:37:55 +0700 Subject: [PATCH] fix(api): improve access token handling during credential refresh --- README.md | 2 +- src/app/api/usage/[connectionId]/route.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 46914ac2..27760226 100644 --- a/README.md +++ b/README.md @@ -1270,7 +1270,7 @@ Full architecture reference: [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) Thanks to all contributors who helped make 9Router better! -[![Contributors](https://contrib.rocks/image?repo=decolua/9router&max=150&columns=15&anon=1)](https://github.com/decolua/9router/graphs/contributors) +[![Contributors](https://contrib.rocks/image?repo=decolua/9router&max=150&columns=15&anon=1&v=20260309)](https://github.com/decolua/9router/graphs/contributors) --- diff --git a/src/app/api/usage/[connectionId]/route.js b/src/app/api/usage/[connectionId]/route.js index 80e52403..b0830afa 100644 --- a/src/app/api/usage/[connectionId]/route.js +++ b/src/app/api/usage/[connectionId]/route.js @@ -33,8 +33,8 @@ async function refreshAndUpdateCredentials(connection) { const refreshResult = await executor.refreshCredentials(credentials, console); if (!refreshResult) { - // For GitHub, if refreshCredentials fails but we still have accessToken, try to use it directly - if (connection.provider === "github" && connection.accessToken) { + // Refresh failed but we still have an accessToken — try with existing token + if (connection.accessToken) { return { connection, refreshed: false }; } throw new Error("Failed to refresh credentials. Please re-authorize the connection.");