[FEATURE] Provide graceful auth token refresh or API key fallback for Claude Desktop / CLI token mismatch
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When working in environments with strict Single Sign-On (SSO) policies, Claude Desktop forcibly logs out upon web session token expiration, typically every 8 to 12 hours. At the same time, terminal-based instances running Claude Code in PowerShell remain authenticated using persistent keychain tokens or API key configurations. This discrepancy results in abrupt disconnections and workflow interruptions in the Desktop application, while the terminal session continues to operate normally.
Proposed Solution
Implement a graceful session refresh mechanism in Claude Desktop. The application should display a proactive in-app warning prompt, such as "SSO Session Expiring in 15 Minutes - Click to Re-authenticate", prior to invalidation. Furthermore, Claude Desktop should be allowed to execute background token refreshes via OAuth refresh tokens instead of triggering a full, immediate application logout.
Alternative Solutions
Provide an enterprise configuration setting inside Claude Desktop that allows it to use local environment variables, such as ANTHROPIC_API_KEY, or local keychain storage. This would match the current behavior of the Claude Code CLI and bypass the browser SSO dependency entirely for advanced users.
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
Enterprise developers using a dual setup of Claude Desktop and Claude Code CLI under strict corporate IT security policies. When the corporate SSO session reaches its time limit, the developer requires a unified and uninterrupted experience across both the desktop user interface and the terminal, without being abruptly removed from active workflows.
Additional Context
Environment: Windows 11 / Windows Server (PowerShell 7.x)
Identity Provider: Corporate Web SSO (Azure AD)