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

Resolved 💬 3 comments Opened Jan 16, 2026 by bonecondor Closed Jan 19, 2026

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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗