You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Claude Pro/Max auth flow returns Invalid token. #18315
Hi, I’ve been getting a “Failed refresh token” error since this morning. I’ve tried reinstalling Opencode and clearing the cache, but the issue still persists.
I then attempted to reconnect the provider using the Claude Pro/Max auth flow, but now it returns an “Invalid Token” error.
I’m wondering whether this is an issue with my local environment or a bug.
none of these fixes are working , don't install anything like third party plugins in ur machine , and they will put malicious code into ur machine and steal , Just wait until open code officially patch this issue .
Applied the patch from https://github.com/vinzabe/opencode-anthropic-oauth-fix — the PKCE and curl fixes look correct (verified the patched index.mjs is loaded), but token exchange still fails with 429 rate_limit_error both on refresh and fresh login.
I am unable to get this work work even with the proposed fixes. I tested that the subscription and such is working, but auth workflow keeps on returning invalid token. Tested on multiple browser (Zen, Brave, Chromium).
For anyone still hitting OAuth issues with Anthropic, I built opencode-claude-bridge which combines fixes from several community plugins into one. It auto-syncs tokens from Claude CLI's keychain (zero-click if you're already logged in), handles token refresh, and emulates Claude Code's exact request format. Install: just add "plugin": ["opencode-claude-bridge"] to your OpenCode config — it auto-installs from npm.
For all those wondering, the best solution presented so far is just setting up Claude Code as a local "server" of sorts, and then to pipe communicate with it via OpenCode.
For all those wondering, the best solution presented so far is just setting up Claude Code as a local "server" of sorts, and then to pipe communicate with it via OpenCode.
I use that config and now I'ts working. Literally I just modify this:
74 │ "plugin": [
75 ~ │ "opencode-anthropic-auth",
76 ~ │ "opencode-claude-auth"
77 │ ],
And now I can use my models from Anthropic (Claude Pro)
Worked for me, thank you!
Most of the plugins referenced in the above are stale.
Activity
jacocanete commentedon Mar 20, 2026
Same here
I'm on fedora using kitty but I think that's hardly relevant.
github-actions commentedon Mar 20, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is the same as one of these, please add a comment there instead of opening a new one.
ilyeshammadi commentedon Mar 20, 2026
I have same issue on Arch
tad-hq commentedon Mar 20, 2026
Same here on Fedora
mahyarmirrashed commentedon Mar 20, 2026
Anthropic banned OpenCode: https://x.com/thdxr/status/2034730036759339100
akemmanuel commentedon Mar 20, 2026
Same issue.
cckelly commentedon Mar 20, 2026
Same issue
avall commentedon Mar 20, 2026
Logged in claude (PRO Subscription):

cat ~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"snapshot": false,
"plugin": [
"opencode-claude-auth"
]
}
npm ls -g --depth=0 opencode-claude-auth
$HOME/.local/share/mise/installs/node/22.22.1/lib
└── opencode-claude-auth@0.5.2
Restart opencode > /connect > Anthropic (Claude Max or API Key)
... Nothing happens. It seems hanged
Infiland commentedon Mar 20, 2026
They removed it #18186
samuelwilk commentedon Mar 20, 2026
FUCK
1 remaining item
vinzabe commentedon Mar 20, 2026
here's the fix https://github.com/vinzabe/opencode-anthropic-oauth-fix
4rzumanyan commentedon Mar 20, 2026
It works. After applying the fix and logging in again, I saw some error messages, but the Claude models still appeared.
Thanks 🔥
shashilaheshanmaestro commentedon Mar 20, 2026
none of these fixes are working , don't install anything like third party plugins in ur machine , and they will put malicious code into ur machine and steal , Just wait until open code officially patch this issue .
shahidshabbir-se commentedon Mar 20, 2026
New plugin: opencode-anthropic-oauth
For anyone hitting "Invalid token" or "Failed to authorize" — built a plugin that handles the OAuth flow directly. No Claude Code needed.
{ "plugin": ["opencode-anthropic-oauth"] }Then
/connect→ Anthropic → Claude Pro/Max → authorize in browser → paste code → done.Fixes the two root causes identified in this thread:
application/x-www-form-urlencoded(not JSON) for token exchangeUser-Agentheader to avoid 429s~100 lines, zero dependencies beyond OpenCode's plugin SDK.
GitHub: https://github.com/shahidshabbir-se/opencode-anthropic-oauth
crottolo commentedon Mar 20, 2026
Applied the patch from https://github.com/vinzabe/opencode-anthropic-oauth-fix — the PKCE and curl fixes look correct (verified the patched
index.mjsis loaded), but token exchange still fails with 429 rate_limit_error both on refresh and fresh login.What works: https://github.com/shahidshabbir-se/opencode-anthropic-oauth
This is a standalone plugin replacement. Install:
Then replace
opencode-anthropic-authwithopencode-anthropic-oauthin youropencode.json:{ "plugin": [ "opencode-anthropic-oauth" ] }Re-login with
opencode providers login -p anthropic, and it works. Tested withanthropic/claude-sonnet-4-6— token exchange and refresh both succeed.Alternative workaround: Claude models via Antigravity (
google/antigravity-claude-sonnet-4-6) also work fine.deadpyxel commentedon Mar 22, 2026
I am unable to get this work work even with the proposed fixes. I tested that the subscription and such is working, but auth workflow keeps on returning invalid token. Tested on multiple browser (Zen, Brave, Chromium).
dotCipher commentedon Mar 23, 2026
For anyone still hitting OAuth issues with Anthropic, I built opencode-claude-bridge which combines fixes from several community plugins into one. It auto-syncs tokens from Claude CLI's keychain (zero-click if you're already logged in), handles token refresh, and emulates Claude Code's exact request format. Install: just add
"plugin": ["opencode-claude-bridge"]to your OpenCode config — it auto-installs from npm.akemmanuel commentedon Mar 23, 2026
Create
.opencode/plugins/anthropic-oauth.tsand add this:This is one of the easiest fixes right now.
dotCipher commentedon Mar 23, 2026
@akemmanuel
Most people don't like using raw source and find it easier to use a plugin or similar
mahyarmirrashed commentedon Mar 23, 2026
For all those wondering, the best solution presented so far is just setting up Claude Code as a local "server" of sorts, and then to pipe communicate with it via OpenCode.
dotCipher commentedon Mar 23, 2026
Exactly what I do here: https://github.com/dotCipher/opencode-claude-bridge
mrp4sten commentedon Mar 24, 2026
I use that config and now I'ts working. Literally I just modify this:
And now I can use my models from Anthropic (Claude Pro)
IgorTrevelin commentedon Mar 29, 2026
Worked for me, thank you!
dotCipher commentedon Apr 16, 2026
Most of the plugins referenced in the above are stale.
I've been keeping this up-to-date: https://github.com/dotCipher/opencode-claude-bridge