mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
fix(oauth): auto-refresh expired tokens in fetchOAuthUsage
Replace direct token decryption with getValidAccessToken call to enable automatic token expiration check and refresh. This fixes authentication_error when fetching OAuth usage data with expired access tokens.
This commit is contained in:
@@ -1607,12 +1607,9 @@ class ClaudeAccountService {
|
||||
throw new Error('Account not found')
|
||||
}
|
||||
|
||||
// 如果没有提供 accessToken,使用账号存储的 token
|
||||
// 如果没有提供 accessToken,使用 getValidAccessToken 自动检查过期并刷新
|
||||
if (!accessToken) {
|
||||
accessToken = this._decryptSensitiveData(accountData.accessToken)
|
||||
if (!accessToken) {
|
||||
throw new Error('No access token available')
|
||||
}
|
||||
accessToken = await this.getValidAccessToken(accountId)
|
||||
}
|
||||
|
||||
// 如果没有提供 agent,创建代理
|
||||
|
||||
Reference in New Issue
Block a user