Skip to content

OAuth token expired immediately after fresh login - cannot use Claude Code (blocking) #19078

Description

@michaelhdmd

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Environment:

Claude Code v2.1.12
macOS (M1, MacBook Pro 2022)
Claude Max subscription

Issue:
Cannot use Claude Code at all. Two failure modes observed:

Token pre-expired: Fresh OAuth login completes successfully (browser shows "You're all set up for Claude Code"), welcome screen displays, but the very first API call fails with 401: "OAuth token has expired."
Login callback failure: /login command fails with ECONNREFUSED or "Was there a typo in the url or port?" - even though the browser successfully completes auth on Anthropic's side.

Steps to reproduce:

Exit Claude Code
rm -rf ~/.claude (clear all credentials)
Run claude
Run /login
Either: login callback fails with ECONNREFUSED, OR login succeeds but first prompt returns 401 "token expired"

Key difference from #17716:
This is not a mid-session expiration - the token is invalid immediately upon issuance. No prompts can be sent at all. This is a complete blocker, not a UX friction issue.
Additional context:

Occurred Jan 17 and Jan 18, 2026, same time of day (~3pm EST)
Spontaneously resolved after several hours on Jan 17
Credential reset does not fix the issue
No VPN, firewall disabled, Pi-hole disabled during testing

What Should Happen?

After completing the browser OAuth flow, Claude Code should receive a valid token and successfully execute API calls. Users should be able to send prompts immediately after login.

Error Messages/Logs

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_011CXFRbLKkrH6cs3PmDt3b1"} · Please run /login
OAuth error: ECONNREFUSED
Press Enter to retry.
OAuth error: Was there a typo in the url or port?
Press Enter to retry.

Steps to Reproduce

Run claude in terminal
Enter any prompt (e.g., 1x)
Receive 401 "OAuth token has expired" error
Run /login
Either:

Login callback fails with ECONNREFUSED, OR
Browser completes successfully but CLI reports "Was there a typo in the url or port?"

If login appears to succeed, first prompt still returns 401 "token expired"

Workaround attempted (unsuccessful):

Exit Claude Code
rm -rf ~/.claude (clear all credentials)
Run claude
Run /login
Same failure occurs

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.12

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions