claude-code - 💡(How to fix) Fix OAuth token not persisted — Max subscribers forced to /login every session for months [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46924Fetched 2026-04-12 13:29:35
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

OAuth tokens are not being persisted to disk between sessions, forcing Max subscribers to run /login at the start of every single session. This has been a known, recurring issue for months with no resolution. Paying customers are losing time daily to a broken authentication flow.

Error Message

This is not a one-time inconvenience. Every session starts with a broken auth error, context about what the user was working on is lost, and time is wasted. For a paid product, this is unacceptable — especially when the only suggested workaround (API keys) routes around the subscription the user is already paying for.

  • #33879 — API Error 401, OAuth token issue

Root Cause

OAuth tokens are not being persisted to disk between sessions, forcing Max subscribers to run /login at the start of every single session. This has been a known, recurring issue for months with no resolution. Paying customers are losing time daily to a broken authentication flow.

Fix Action

Fix / Workaround

This is not a one-time inconvenience. Every session starts with a broken auth error, context about what the user was working on is lost, and time is wasted. For a paid product, this is unacceptable — especially when the only suggested workaround (API keys) routes around the subscription the user is already paying for.

RAW_BUFFERClick to expand / collapse

Summary

OAuth tokens are not being persisted to disk between sessions, forcing Max subscribers to run /login at the start of every single session. This has been a known, recurring issue for months with no resolution. Paying customers are losing time daily to a broken authentication flow.

What happens

  1. Start Claude Code → 401 "Invalid authentication credentials"
  2. Run /login → "Login successful"
  3. Session works fine
  4. Close session, open new one → back to step 1

The credentials file (~/.claude/.credentials.json) does not exist between sessions. The token appears to be held in memory only and never written to disk, or is written and then invalidated server-side before the next session.

What I've tried

  • rm ~/.claude/.credentials.json && claude login — fixes it temporarily, same issue next session
  • rm -rf ~/.claude/.credentials.json ~/.config/claude-code/auth.json — neither file exists anymore, problem persists
  • This has been happening repeatedly over multiple weeks

Environment

  • macOS (Darwin 24.6.0)
  • Claude Code CLI (latest)
  • Claude Max subscription (active, correctly shown on welcome screen)

Impact

This is not a one-time inconvenience. Every session starts with a broken auth error, context about what the user was working on is lost, and time is wasted. For a paid product, this is unacceptable — especially when the only suggested workaround (API keys) routes around the subscription the user is already paying for.

Related issues

This is a recurring, unresolved pattern across many reports:

  • #40473 — 401 after successful /login, token not persisting (12+ hours, 10+ attempts)
  • #44930 — claude login fails with 401, no browser flow, no recovery path after 34+ hours
  • #33811 — OAuth token expired, login/logout/all commands fail, no recovery path
  • #33879 — API Error 401, OAuth token issue
  • #17966 — Re-authentication causes 401, subscription not recognized
  • #44264 — Claude OAuth is down
  • #44092 — Authentication issue
  • #15007 — /login does not recover active session after token expiration

None of these have been resolved. This is not an edge case — it is a systemic failure in the OAuth token lifecycle that is actively degrading the experience for paying subscribers.

extent analysis

TL;DR

The OAuth token persistence issue can be mitigated by ensuring the credentials file is properly written to disk and persisted between sessions.

Guidance

  • Verify the existence and permissions of the ~/.claude/.credentials.json file to ensure it can be written and read by the Claude Code CLI.
  • Check the Claude Code CLI configuration to see if there are any settings related to token persistence or credentials storage that can be adjusted.
  • Consider implementing a workaround to manually persist the token to disk after a successful login, if the CLI does not provide a built-in mechanism for doing so.
  • Investigate the related issues listed to see if any of them provide additional insight or potential solutions to the token persistence problem.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The root cause of the issue appears to be related to the OAuth token lifecycle and persistence, but without further information, it is difficult to provide a definitive solution. The provided guidance is intended to help mitigate the issue and provide a starting point for further investigation.

Recommendation

Apply workaround: The issue is likely related to the token persistence mechanism, and applying a workaround to manually persist the token to disk may provide a temporary solution until a more permanent fix can be implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING