Skip to content

OAuth token expires mid-session in Claude Desktop with no recovery path #18444

Closed as duplicate

Description

@bonecondor

Bug Report: OAuth token expires mid-session in Claude Desktop

Summary

OAuth token expires during active Claude Code sessions within Claude Desktop, causing API errors with no recovery path.

Environment

  • Claude Desktop version: 2.0.72
  • macOS Darwin 24.6.0
  • Using Claude Code within Claude Desktop (not standalone CLI)

Steps to Reproduce

  1. Start a new Claude Code session in Claude Desktop
  2. Have an active conversation (sending messages, using tools)
  3. Within ~10 minutes of active use, receive OAuth error

Expected Behavior

OAuth token should refresh transparently without interrupting the session.

Actual Behavior

Session fails with:

API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."},"request_id":"req_011CXA57hmxzRRfj59eBrqDH"} · Please run /login

The error suggests running /login, but this command does not exist in Claude Desktop's Claude Code integration.

Log Evidence

From ~/Library/Logs/Claude/main.log:

2026-01-15 10:58:32 [info] refreshing oauth token now
2026-01-15 10:58:33 [info] oauth token refreshed, now persisting
2026-01-15 11:05:40 [info] performing fresh oauth exchange
2026-01-15 11:35:40 [info] performing fresh oauth exchange
2026-01-15 18:28:45 [info] performing fresh oauth exchange
2026-01-15 18:41:01 [info] performing fresh oauth exchange

The logs show OAuth exchanges happening, but tokens still expire mid-session.

Analysis

Appears to be a race condition where:

  1. Session makes an API call
  2. OAuth token expires at that moment
  3. Refresh hasn't propagated yet
  4. API returns 401

Impact

  • Session becomes unusable
  • No way to recover without starting a new conversation
  • Work in progress is lost
  • Error message references non-existent /login command

Requested Fix

  1. Implement proactive token refresh before expiration (not reactive)
  2. Add retry logic when 401 is encountered to attempt token refresh
  3. Either implement /login for Claude Desktop or remove it from error message
  4. Provide a UI-based way to manually refresh auth if needed

Workaround

Starting a new conversation forces a fresh OAuth exchange and usually works.

Activity

  1. added
    bug
    has repro
    platform:macos
    on Jan 16, 2026
  2. github-actions commented on Jan 16, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. MCP OAuth tokens expire in idle conversations with no way to re-authenticate #18442
    2. Bug: /login Does Not Recover Active Session After OAuth Token Expiration #15007
    3. Authentication token expiration causes request failures even after re-authentication #15137

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  3. github-actions commented on Jan 19, 2026

    @github-actions

    This issue has been automatically closed as a duplicate of #18442.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  4. added
    duplicate
    and removed
    bug
    has repro
    platform:macos
    on Jan 19, 2026
  5. github-actions commented on Jan 26, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  6. locked as resolved and limited conversation to collaborators on Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions