feat(auth): enhance Antigravity token refresh with robust error handling and retry logic
- Add AntigravityTokenRefreshError custom error class with code, description, and status fields - Implement parseOAuthErrorPayload() for parsing Google's various OAuth error response formats - Add retry logic with exponential backoff (3 retries, 1s→2s→4s delay) for transient failures - Add special handling for invalid_grant error - immediately throws without retry and clears caches - Add invalidateProjectContextByRefreshToken() for selective cache invalidation - Update fetch.ts error handling to work with new error class and cache invalidation 🤖 Generated with assistance of OhMyOpenCode (https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -267,3 +267,8 @@ export function clearProjectContextCache(accessToken?: string): void {
|
||||
projectContextCache.clear()
|
||||
}
|
||||
}
|
||||
|
||||
export function invalidateProjectContextByRefreshToken(_refreshToken: string): void {
|
||||
projectContextCache.clear()
|
||||
debugLog(`[invalidateProjectContextByRefreshToken] Cleared all project context cache due to refresh token invalidation`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user