Commit c227fff
committed
fix(anthropic): reveal real auth-rejection reason; match Claude Code OAuth shape
A 401/403 from the Messages API was flattened to a generic "credential
rejected / regenerate your API key" message that hid Anthropic's actual
reason and wrongly assumed an API key even on the OAuth subscription path.
- callAnthropic now keeps the HTTP status and Anthropic's own message on the
thrown error, so categorizeError classifies by status (not keyword-guessing)
and the real reason can surface.
- errors.js surfaces the provider's reason for auth failures instead of the
canned line; output-tab's hint now covers both subscription sign-in and API
keys.
- Send the OAuth system prompt as the structured Claude Code identity block
the real CLI uses, so subscription tokens are more likely to be honored.
Adds tests covering the surfaced-reason and bare-status auth cases.1 parent 705baf5 commit c227fff
4 files changed
Lines changed: 38 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1829 | 1829 | | |
1830 | 1830 | | |
1831 | 1831 | | |
1832 | | - | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
1833 | 1836 | | |
1834 | 1837 | | |
1835 | 1838 | | |
| |||
1844 | 1847 | | |
1845 | 1848 | | |
1846 | 1849 | | |
1847 | | - | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
1848 | 1857 | | |
1849 | 1858 | | |
1850 | 1859 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
657 | | - | |
| 657 | + | |
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
17 | 32 | | |
18 | 33 | | |
19 | 34 | | |
| |||
0 commit comments