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 OAuth token requires re-authentication after every usage limit reset #15562
Describe the bug
When using Claude via OAuth (claude.ai subscription), opencode requires me to re-authenticate every time a usage limit resets. Claude.ai has two types of limits:
A 5-hour rolling limit (resets every ~5 hours)
A monthly quota
Both trigger a full re-authentication flow in opencode. This means I may need to re-login multiple times per day.
Expected behavior
OAuth tokens should be refreshed automatically using the refresh token. Re-authentication should only be required when the user explicitly logs out or when the token is truly invalidated — not on usage limit resets.
Actual behavior
After hitting either the 5-hour or monthly usage limit, opencode throws an authentication error and requires a full re-login via opencode auth login.
Why this matters
Users on Claude.ai subscription plans (Pro/Max) cannot use API keys — OAuth is their only option. Other providers do not have this issue. This is likely caused by opencode treating a 429 rate-limited or quota-exceeded response as an auth failure, and/or not properly storing/using the OAuth refresh token.
Steps to reproduce
Log in with opencode auth login using Claude OAuth
Use opencode until Claude.ai usage limit is hit (can happen within 5 hours)
Wait for the limit to reset
Try to use opencode again → re-authentication required
Environment
Provider: Claude (claude.ai OAuth)
Subscription: Claude Pro/Max (not API key)
Related fix for the token exchange 429 issue that causes forced re-authentication:
The opencode-anthropic-auth plugin was missing the User-Agent header and using wrong Content-Type for OAuth token requests. This causes Anthropic's token endpoint to return 429, which OpenCode interprets as an auth failure requiring full re-login.
Activity
github-actions commentedon Mar 1, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is the same as one of the above, please add a comment there instead so the discussion stays in one place.
coskunhasib commentedon Mar 1, 2026
win11 pro 25H2 26200.7840
opencode dektop app
MoerAI commentedon Mar 20, 2026
Related fix for the token exchange 429 issue that causes forced re-authentication:
The
opencode-anthropic-authplugin was missing theUser-Agentheader and using wrongContent-Typefor OAuth token requests. This causes Anthropic's token endpoint to return 429, which OpenCode interprets as an auth failure requiring full re-login.PR: ex-machina-co/opencode-anthropic-auth#12
See detailed analysis at #18329 (comment)