claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Claude Desktop App stuck in login loop with 'Invalid authorization' error

Open SingCheung opened this issue 9 months ago • 26 comments

Bug Description

Claude Desktop App (v1.1.1520) on macOS is unable to authenticate. Every launch immediately produces Invalid authorization errors from the REACT_QUERY_CLIENT. Login via magic link fails repeatedly. The app is completely unusable.

Environment

  • App version: 1.1.1520
  • Platform: macOS (darwin, arm64)
  • Node version: 22.21.1
  • CCD version: 2.1.22

Error Logs

From ~/Library/Logs/Claude/claude.ai-web.log:

2026-02-02 18:32:42 [error] [REACT_QUERY_CLIENT] QueryClient error: Error: Invalid authorization
2026-02-02 18:33:16 [error] [REACT_QUERY_CLIENT] QueryClient error: TypeError: Failed to fetch (claude.ai)
2026-02-02 18:33:16 [error] [REACT_QUERY_CLIENT] QueryClient error: Error: Invalid authorization
2026-02-02 19:03:43 [error] [REACT_QUERY_CLIENT] QueryClient error: Error: login_link_not_found
2026-02-02 19:38:50 [error] [REACT_QUERY_CLIENT] QueryClient error: Error: login_link_already_used
2026-02-02 20:37:40 [error] Refused to connect to 'https://a-api.anthropic.com/v1/m' because it violates the following Content Security Policy directive: "connect-src 'self' https://api.segment.io https://*.segment.io https://*.segment.com https://a-cdn.anthropic.com https://*.google.com https://*.facebook.com https://*.facebook.net https://*.doubleclick.net".
2026-02-02 20:37:40 [error] Fetch API cannot load https://a-api.anthropic.com/v1/m. Refused to connect because it violates the document's Content Security Policy.
2026-02-02 20:48:56 [error] [REACT_QUERY_CLIENT] QueryClient error: Error: ["account_profile"] data is undefined

These errors repeat on every app launch. The app was restarted 10+ times over ~3.5 hours with the same result every time.

Symptoms

  1. App launches and immediately gets Invalid authorization on every API query
  2. account_profile data is undefined — profile cannot be fetched
  3. Failed to fetch (claude.ai) — network requests to claude.ai fail
  4. Magic link login returns login_link_not_found or login_link_already_used
  5. CSP violation blocks requests to https://a-api.anthropic.com/v1/m
  6. Cookies DB shows a pendingLogin cookie but no session/auth cookie is ever created
  7. The app gets stuck on the login page (https://claude.ai/login?returnTo=%2Fmagic-link)

Steps to Reproduce

  1. Open Claude Desktop App on macOS
  2. App shows login screen
  3. Enter email, receive magic link
  4. Click magic link — app briefly loads then falls back to Invalid authorization
  5. All subsequent API calls fail

Troubleshooting Already Attempted (all failed)

  • Full quit and relaunch (10+ times)
  • Complete deletion of ~/Library/Application Support/Claude/ (cookies, local storage, session storage, config, caches, network state)
  • Deletion of ~/Library/Caches/Claude/
  • Deletion of ~/Library/Preferences/com.anthropic.claudefordesktop.plist
  • Deletion of ~/Library/Saved Application State/com.anthropic.claudefordesktop.savedState
  • Deletion of ~/Library/WebKit/ and ~/Library/HTTPStorages/ for Claude
  • defaults delete com.anthropic.claudefordesktop
  • Checked macOS Keychain — no Claude/Anthropic entries found
  • Tried logging in via browser first, then opening desktop app
  • Tried older versions of the app
  • No VPN or DNS filter active

Possibly Related Issues

  • #20016 (Cowork tab stuck / Invalid authorization)
  • #18474 (Claude Cowork stuck on 'sending request')
  • #10503 (Invalid bearer token persists after login)

Expected Behavior

App should authenticate successfully after clicking the magic link and display the main chat interface.

Actual Behavior

App is stuck in an infinite login loop. Auth token is never persisted. All API calls return Invalid authorization.

SingCheung avatar Feb 03 '26 06:02 SingCheung

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/18474
  2. https://github.com/anthropics/claude-code/issues/20136

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

github-actions[bot] avatar Feb 03 '26 06:02 github-actions[bot]

Also having the same issue with the Desktop App. Browser and Code work fine

Jbarata98 avatar Feb 03 '26 10:02 Jbarata98

+1 - Having issues with desktop app.

Arvindh-Mojo avatar Feb 03 '26 13:02 Arvindh-Mojo

+1

martinsober avatar Feb 12 '26 10:02 martinsober

Likewise

jondashkyle avatar Feb 13 '26 18:02 jondashkyle

same

defcube avatar Feb 16 '26 19:02 defcube

Just got the same issue today.

sbusso avatar Feb 17 '26 01:02 sbusso

+1 for me on Claude Mac OS Desktop App, Am in version 1.1.3189(1b7b58) keep on looping on the cloudflare login page, browser works fine, restarted the machine still its same.

saigop avatar Feb 17 '26 01:02 saigop

Followed the below steps, and its working fine now,

  1. Uninstall Claude.app from Application, I did via terminal

rm -rf /Applications/Claude.app

  1. Remove Cache, Application Support and preferences

rm -rf ~/Library/Application\ Support/Claude rm -rf ~/Library/Caches/Claude rm -rf ~/Library/Preferences/com.anthropic.claude.plist rm -rf ~/Library/Saved\ Application\ State/com.anthropic.claude.savedState rm -rf ~/Library/Logs/Claude

  1. Restarted Mac
  2. Downloaded fresh copy of Claude app & Installed
  3. It worked.. !

saigop avatar Feb 17 '26 03:02 saigop

Fix for Cloudflare login loop — preserving Cowork chats

Had the same issue (macOS, Cloudflare verification loop, app-specific — browser worked fine). Things that didn't work: changing DNS to Google (8.8.8.8), flushing DNS cache, tethering to mobile hotspot, deleting only Caches/Preferences/SavedState, or selectively clearing auth files (Cookies, Session Storage, Local Storage, etc.).

What did work was wiping ~/Library/Application Support/Claude — but with a backup step to preserve Cowork local chats:

# 1. Back up Cowork chats (stored only locally)
cp -r ~/Library/Application\ Support/Claude/local-agent-mode-sessions ~/Desktop/cowork-backup

# 2. Wipe app data
rm -rf ~/Library/Application\ Support/Claude
rm -rf ~/Library/Caches/Claude

# 3. Cmd+Q Claude and reopen — login should work

# 4. Restore Cowork chats
cp -r ~/Desktop/cowork-backup ~/Library/Application\ Support/Claude/local-agent-mode-sessions

No need to uninstall the app, restart the Mac, or re-download. All Cowork chat history was preserved.

alexis-alem avatar Feb 17 '26 10:02 alexis-alem

Confirming @alexis-alem's solution works.

onewil avatar Feb 17 '26 13:02 onewil

I have the same issue with ssh into remote instance.

macman123 avatar Mar 05 '26 10:03 macman123

Can confirm @alexis-alem's solution works.

princess-mimi-stackd avatar Mar 08 '26 17:03 princess-mimi-stackd

Similar problem with Claude Code (CC) terminal frontend on Linux:

  • me: Launch claude
  • me: Log-in via browser
  • CC: "Login successful. Press Enter to continue…"
  • me: Enter
  • CC: prompt
  • me: whatsoever
  • CC: "Your account does not have access to Claude Code. Please run /login."

Complete purge and reinstallation did not help.

Deleting and recreating the Team seat did not help.

Support request to [email protected] is answered by a clueless bot. After a couple of iterations, the bot mentioned the possibility of human intervention and fell silent. Now waiting since 10 days for a human @ Anthropic to respond.

jwuttke avatar Mar 10 '26 10:03 jwuttke

I have the same issue with ssh into remote instance.

I had to install CLI version of the Claude in a terminal and run login there, then it started working in VS code,

macman123 avatar Mar 10 '26 19:03 macman123

Solution to my endless log-in logged-out loop, https://github.com/anthropics/claude-code/issues/22685#issuecomment-4030150382:

There was an environment variable CLAUDE_CODE_OAUTH_TOKEN. Removing it solved the problem.

The lack of a clear error message is a severe bug of Claude Code.

jwuttke avatar Mar 12 '26 14:03 jwuttke

Looks like there might be a regression in v1.1.7203 (034f07) — 2026-03-17. The app fails to clear the sessionKey cookie on logout, causing an auth loop on re-login.

Environment

  • App version: 1.1.7203 (034f07), 2026-03-17T17:48:28.000Z
  • Platform: macOS (darwin, arm64)

Reproduction

  1. Log out of Claude Desktop
  2. App redirects to https://claude.ai/login?from=logout
  3. Log back in
  4. App enters an infinite auth loop — never reaches the main UI

Log sequence from ~/Library/Logs/Claude/main.log

  Identity changed (loggedOut: true → false, uuid: <none> → <uuid>)                                                     
  [oauth] performing fresh oauth exchange for orgId=<orgId>                                                             
  oauth failed: no sessionKey cookie found                                                                              
  [oauth] failed to obtain oauth token (not_logged_in): no sessionKey cookie found                                      
  [RemotePluginManager] Sync failed: Failed to fetch auto-installed plugins (HTTP 403)                                  
  Failed to fetch skills list: 403 {"error":{"type":"permission_error","message":"Invalid                               
  authorization","details":{"error_code":"account_session_invalid"}}}                                                   
  Cannot get base query config: oauth failed (not_logged_in): no sessionKey cookie found                                
  Identity changed (loggedOut: false → true, uuid: <uuid> → <none>)                                                     

This cycle repeats indefinitely. The app detects an account, attempts OAuth, finds no valid session cookie, gets 403, logs out, and starts over.

Workaround:

Deleting the cookie store breaks the loop:

# Quit Claude Desktop first                                                                                           
rm ~/Library/Application\ Support/Claude/Cookies                                                                      
rm ~/Library/Application\ Support/Claude/Cookies-journal                                                              
# Relaunch and log in                                                                                                 

This must be repeated every time you log out — the logout flow consistently leaves the cookie store in a broken state. No stale env vars (CLAUDE_CODE_OAUTH_TOKEN etc.) are present.

sheyaln avatar Mar 18 '26 20:03 sheyaln

Looks like there might be a regression in v1.1.7203 (034f07) — 2026-03-17. The app fails to clear the sessionKey cookie on logout, causing an auth loop on re-login.

Environment

  • App version: 1.1.7203 (034f07), 2026-03-17T17:48:28.000Z
  • Platform: macOS (darwin, arm64)

Reproduction

  1. Log out of Claude Desktop
  2. App redirects to https://claude.ai/login?from=logout
  3. Log back in
  4. App enters an infinite auth loop — never reaches the main UI

Log sequence from ~/Library/Logs/Claude/main.log

  Identity changed (loggedOut: true → false, uuid: <none> → <uuid>)                                                     
  [oauth] performing fresh oauth exchange for orgId=<orgId>                                                             
  oauth failed: no sessionKey cookie found                                                                              
  [oauth] failed to obtain oauth token (not_logged_in): no sessionKey cookie found                                      
  [RemotePluginManager] Sync failed: Failed to fetch auto-installed plugins (HTTP 403)                                  
  Failed to fetch skills list: 403 {"error":{"type":"permission_error","message":"Invalid                               
  authorization","details":{"error_code":"account_session_invalid"}}}                                                   
  Cannot get base query config: oauth failed (not_logged_in): no sessionKey cookie found                                
  Identity changed (loggedOut: false → true, uuid: <uuid> → <none>)                                                     

This cycle repeats indefinitely. The app detects an account, attempts OAuth, finds no valid session cookie, gets 403, logs out, and starts over.

Workaround:

Deleting the cookie store breaks the loop:

# Quit Claude Desktop first                                                                                           
rm ~/Library/Application\ Support/Claude/Cookies                                                                      
rm ~/Library/Application\ Support/Claude/Cookies-journal                                                              
# Relaunch and log in                                                                                                 

This must be repeated every time you log out — the logout flow consistently leaves the cookie store in a broken state. No stale env vars (CLAUDE_CODE_OAUTH_TOKEN etc.) are present.

This solution did not work for me. I have Claude 1.1.7714 (3bd6f6) 2026-03-19T14:50:53.000Z

chiragpurohit71085 avatar Mar 22 '26 18:03 chiragpurohit71085

I'm hesitant to rm -rf ~/Library/Application\ Support/Claude because my Claude Code CLI is still working. I don't know if it shares anything in the same directory. But Claude Desktop is still in login loop after deleting the cookies and cookies-journal.

5amfung avatar Mar 22 '26 19:03 5amfung

I'm hesitant to rm -rf ~/Library/Application\ Support/Claude because my Claude Code CLI is still working. I don't know if it shares anything in the same directory. But Claude Desktop is still in login loop after deleting the cookies and cookies-journal.

What do your logs look like during the loop? ~/Library/Logs/Claude/main.log

sheyaln avatar Mar 22 '26 19:03 sheyaln