[Bug] OAuth callback timeout causes "Failed to fetch user roles" error

Resolved 💬 22 comments Opened Jan 22, 2026 by lasergoat Closed Mar 6, 2026

Bug Description
OAuth callback timeout in Claude Code authentication
Reproducible issue where /login command triggers OAuth flow, but clicking "Authorize" results in long delay on callback route (http://localhost:60869/callback) followed by 500 error and "Failed to fetch user roles" message in terminal. Issue persists across multiple attempts and different sessions. Occurs consistently - but did not occur yesterday. Note: last night I had to switch to Extra Usage plan and then when the usage window reset, claude code did not automatically switch back, I had to run /login but that all worked fine - so not sure if it's related. Authentication eventually succeeds after 3-4 retry attempts, suggesting server-side timeout/processing issue rather than client configuration problem.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.11
  • Feedback ID: 440dc956-9a41-4b55-b38a-4df04cf4d01d

Errors

[{"error":"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_011CXNfLsXi9o5HmrboV37h1\"}\n    at P2.generate (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:917:2113)\n    at Jj.makeStatusError (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:934:2195)\n    at Jj.makeRequest (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:934:5420)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2026-01-22T15:35:01.778Z"},{"error":"Error: Failed to delete keychain entry\n    at Fs2 (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:3338:6963)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async VI9 (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:4626:626)\n    at async zS2 (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:4626:530)\n    at async R$0 (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:2362:67483)\n    at async GvA.startOAuthFlow (file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:2362:69045)\n    at async file:///Users/daniel/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/cli.js:2367:29147","timestamp":"2026-01-22T15:39:25.785Z"}]

View original on GitHub ↗

22 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/19456
  2. https://github.com/anthropics/claude-code/issues/1305
  3. https://github.com/anthropics/claude-code/issues/19078

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

Kabilan108 · 5 months ago

Having the same issue trying to login to cc this morning. I've been using the Max plan and haven't had to switch into extra usage. This morning cc started with me using the Claude API. I tried to log in to my account and have been running into the same error all morning.

notorious94 · 5 months ago

such a horrible way to authenticate user

lasergoat · 5 months ago
Having the same issue trying to login to cc this morning. I've been using the Max plan and haven't had to switch into extra usage. This morning cc started with me using the Claude API. I tried to log in to my account and have been running into the same error all morning.

I was on extra usage last night just because I ran over my usage - and when I switched back to normal usage I had to /login and re-select the max plan. But this issue didn't happen until this morning. Since you're having the same issue it sounds totally unrelated to extra usage. It sounds like their identity service was having some temporary glitch - but hopefully us opening issues like this can help them find and bolster it.

such a horrible way to authenticate user

@notorious94 what do you mean, what would be a better approach?

reminia · 5 months ago

same issue here, encountered many time today on Max plan.

github-actions[bot] · 4 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

jaydio · 4 months ago

Still seems to be happening. On max plan, limits not reached. CC session just expired and cannot log back in.

<img width="637" height="405" alt="Image" src="https://github.com/user-attachments/assets/3d9c0d4c-38a2-4067-9eda-3014df7ac97b" />

Ericlein · 4 months ago
aldochaconc · 4 months ago
Still seems to be happening. On max plan, limits not reached. CC session just expired and cannot log back in.

Can confirm I have the same issue. Just today.

  • With /login and claude login
  • Cleared browser cache
  • Used private browser

<img width="518" height="397" alt="Image" src="https://github.com/user-attachments/assets/d62b4c88-819d-48fb-8336-69ee78243faa" />

teoobarca · 4 months ago

🤦

juancciope · 4 months ago

<img width="514" height="408" alt="Image" src="https://github.com/user-attachments/assets/e1ce785a-aa33-421f-8852-214dcbb9347f" /> Same Issues over here!

mahakim89 · 4 months ago

same issue on my end
suddenly getting auth error and had to /login but got this error every time I tried to login
we are going to have a melt down.
<img width="1129" height="409" alt="Image" src="https://github.com/user-attachments/assets/7e599ff2-31ed-4ba2-b63c-722a51eb6af1" />

peter-mw · 4 months ago

I have the same issue

<img width="989" height="496" alt="Image" src="https://github.com/user-attachments/assets/93fd8399-f831-430a-8226-3a56dcbc9004" />

jaydio · 4 months ago

Apologies for the necro post, that backfired quite a bit.

Folks, follow the status link; this is unrelated and a known issue:

https://status.claude.com/incidents/jm3b4jjy2jrt

DO NOT COMMENT ON THIS TICKET.

jaydio · 4 months ago
inonbaguio · 4 months ago

Any updates in here?

simontong · 4 months ago

Is there a way to extend the timeout for OAuth?

JSiapoRimac · 4 months ago

Solved!

devnulled · 4 months ago

This seems easily fixable on the client side if there is a way to extend the timeout manually via config or some other means.

The API has been working, its just slow and always exceeds this 15s timeout.

kkliah · 4 months ago

<img width="799" height="646" alt="Image" src="https://github.com/user-attachments/assets/bbf85b39-09ff-413f-8e4f-2875cb213759" /> SAME

teoobarca · 4 months ago

@simontong There is a workaround. Shoutout to @doctorfarhan from https://github.com/anthropics/claude-code/issues/33239.

You can use codex with the following prompt to adjust the timeout:

On macOS, patch my installed Claude Code binary at ~/.local/share/claude/versions/2.1.72 to change only the OAuth token exchange/refresh timeout from 15000 to 60000, save a backup, re-sign it with `codesign --force --sign -`, and verify `claude --version` still works.
github-actions[bot] · 3 months ago

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.