()
| 183 | export type ManagedOAuthState = 'none' | 'usable' | 'expired' |
| 184 | |
| 185 | export function getManagedOAuthState(): ManagedOAuthState { |
| 186 | if (!isAnthropicAuthEnabled()) { |
| 187 | return 'none' |
| 188 | } |
| 189 | |
| 190 | const oauthTokens = getClaudeAIOAuthTokens() |
| 191 | if (!oauthTokens?.accessToken || !shouldUseClaudeAIAuth(oauthTokens.scopes)) { |
| 192 | return 'none' |
| 193 | } |
| 194 | |
| 195 | return getUsableClaudeAiAccessToken() ? 'usable' : 'expired' |
| 196 | } |
| 197 | |
| 198 | export function getAuthTokenSource() { |
| 199 | // --bare: API-key-only. apiKeyHelper (from --settings) is the only |
no test coverage detected