mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 17:27:54 +00:00
fix: unexpected re-auth when auth-token is expired (#549)
This commit is contained in:
@@ -153,17 +153,10 @@ export class QwenContentGenerator extends OpenAIContentGenerator {
|
||||
return await attemptOperation();
|
||||
} catch (error) {
|
||||
if (this.isAuthError(error)) {
|
||||
try {
|
||||
// Use SharedTokenManager to properly refresh and persist the token
|
||||
// This ensures the refreshed token is saved to oauth_creds.json
|
||||
await this.sharedManager.getValidCredentials(this.qwenClient, true);
|
||||
// Retry the operation once with fresh credentials
|
||||
return await attemptOperation();
|
||||
} catch (_refreshError) {
|
||||
throw new Error(
|
||||
'Failed to obtain valid Qwen access token. Please re-authenticate.',
|
||||
);
|
||||
}
|
||||
// Use SharedTokenManager to properly refresh and persist the token
|
||||
// This ensures the refreshed token is saved to oauth_creds.json
|
||||
await this.sharedManager.getValidCredentials(this.qwenClient, true);
|
||||
return await attemptOperation();
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user