fix(api): improve access token handling during credential refresh
This commit is contained in:
parent
31775393e6
commit
a501c05969
2 changed files with 3 additions and 3 deletions
|
|
@ -1270,7 +1270,7 @@ Full architecture reference: [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)
|
||||||
|
|
||||||
Thanks to all contributors who helped make 9Router better!
|
Thanks to all contributors who helped make 9Router better!
|
||||||
|
|
||||||
[](https://github.com/decolua/9router/graphs/contributors)
|
[](https://github.com/decolua/9router/graphs/contributors)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ async function refreshAndUpdateCredentials(connection) {
|
||||||
const refreshResult = await executor.refreshCredentials(credentials, console);
|
const refreshResult = await executor.refreshCredentials(credentials, console);
|
||||||
|
|
||||||
if (!refreshResult) {
|
if (!refreshResult) {
|
||||||
// For GitHub, if refreshCredentials fails but we still have accessToken, try to use it directly
|
// Refresh failed but we still have an accessToken — try with existing token
|
||||||
if (connection.provider === "github" && connection.accessToken) {
|
if (connection.accessToken) {
|
||||||
return { connection, refreshed: false };
|
return { connection, refreshed: false };
|
||||||
}
|
}
|
||||||
throw new Error("Failed to refresh credentials. Please re-authorize the connection.");
|
throw new Error("Failed to refresh credentials. Please re-authorize the connection.");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue