* Check if user is authenticated with first-party OAuth. * Required for settings sync in both CLI (upload) and CCR (download) modes. * * Only checks user:inference (not user:profile) — CCR's file-descriptor token * hardcodes scopes to ['user:inference'] only, so requiring profile would make * d
()
| 210 | * download a no-op there. Upload is independently guarded by getIsInteractive(). |
| 211 | */ |
| 212 | function isUsingOAuth(): boolean { |
| 213 | if (getAPIProvider() !== 'firstParty' || !isFirstPartyAnthropicBaseUrl()) { |
| 214 | return false |
| 215 | } |
| 216 | |
| 217 | const tokens = getClaudeAIOAuthTokens() |
| 218 | return Boolean( |
| 219 | tokens?.accessToken && tokens.scopes?.includes(CLAUDE_AI_INFERENCE_SCOPE), |
| 220 | ) |
| 221 | } |
| 222 | |
| 223 | function getSettingsSyncEndpoint(): string { |
| 224 | return `${getOauthConfig().BASE_API_URL}/api/claude_code/user_settings` |
no test coverage detected