Claude Code Login Loops on Authorize? Fix It Safely

Claude Code Login Loops on Authorize? Fix It Safely

Aident AI

Two blue circular paths open through a silver checkpoint into one clear teal route.

Claude Code Login Loops on Authorize? Fix It Safely

If Claude Code opens the browser, you click Authorize, and Claude asks you to sign in again before returning to the same Authorize screen, stop repeating the same browser flow. Keep your local projects and session data intact. Start one fresh login, open its exact authorization URL in a private browser session that is already signed in to the intended Claude account, and use the manual verification-code path when it is offered.

Use this order:

  1. Confirm that this is the Authorize and sign-in loop, not an expired token, API-key override, or service incident.

  2. Record the version, diagnostic result, active authentication method, and clock state.

  3. Reset authentication once with Claude Code's documented logout and login flow.

  4. Move the same fresh authorization URL to a private browser session and complete the manual-code fallback.

  5. Stop after one controlled retry and collect evidence for support if the loop remains.

Do not delete ~/.claude, remove project transcripts, paste an OAuth token into chat, disable browser security, or request a series of email links. Those actions do not repair the browser-to-terminal handoff and can destroy useful evidence.

Match the Exact Failure

This guide applies to the following sequence:

Claude Code asks you to authenticate
Browser opens an Authorize page
You click Authorize
Browser says "Sign in again to continue"
You sign in by email or an identity provider
Browser returns to Authorize, then repeats the same cycle

Use a different diagnosis when Claude Code reports OAuth token has expired, Invalid code, organization disabled, or a provider-specific credential error. Anthropic's error reference treats those as separate failures. If authentication succeeds but the wrong account or plan is active, check /status and the account selected in the browser before changing local files.

The active July 2026 issue uses the wording “state parameter dropped after sign in again,” but Anthropic has not confirmed that root cause in the thread. Treat the title as a report, not a verified protocol diagnosis.

Prerequisites

Close or finish any Claude Code work that cannot be interrupted. Keep one terminal for the recovery attempt and close extra Claude Code sessions so several processes do not compete to refresh the same saved login.

Record the non-secret state:

claude --version
claude doctor
env | awk -F= '/^ANTHROPIC_(API_KEY|AUTH_TOKEN)=/{print $1}'

Inside Claude Code, run:

/status

On Windows PowerShell, list only relevant variable names, not their values:

claude --version
claude doctor
Get-ChildItem Env: |
  Where-Object Name -Match '^ANTHROPIC_(API_KEY|AUTH_TOKEN)$' |
  Select-Object -ExpandProperty Name

Expected result: you know the Claude Code version, whether diagnostics report a credential-store problem, which authentication method /status sees, and whether an API credential could be overriding a subscription login. Do not print or share the variable values.

Also check Anthropic's service status. If authentication is an active incident, preserve the evidence and wait instead of cycling through login links.

Step 1: Run One Clean Documented Reset

Inside Claude Code, run:

/logout

Exit Claude Code completely, open a new terminal, and start the dedicated login command:

claude auth login

Anthropic documents /logout followed by a new login as the normal reset. It also documents claude auth login for terminals where the interactive paste field or automatic browser return is unreliable.

Expected result: Claude Code prints or opens one new authorization URL and waits for that login attempt. Keep this URL paired with this terminal. Do not reuse a URL or code from an earlier attempt.

If the clean flow succeeds, reopen Claude Code and verify /status. Stop there. A successful fresh attempt is evidence that the failure was intermittent, not proof of a particular root cause.

Step 2: Isolate the Browser Session

If the fresh attempt loops, close the browser window that handled it. Open a private or incognito window in a current browser and sign in directly at claude.ai with the account you want Claude Code to use.

Run claude auth login again to create a new attempt. Copy its exact URL into that private window. At an interactive login prompt, Claude Code also lets you press c to copy the OAuth URL instead of relying on automatic browser launch.

Expected result: the new attempt uses one clean cookie context and one known Claude account. If it completes, run /status and confirm the subscription or organization shown is the intended one.

This is a containment test. Reports in the active issue found different results across Safari, Firefox, Chrome, private windows, and a phone. That variation suggests browser or session state is involved, but it does not prove the provider-side cause.

Step 3: Use the Manual Verification-Code Path

If the page offers Enter verification code, use it for this fresh attempt:

  1. Keep claude auth login waiting in the terminal.

  2. Open the exact new authorization URL in the private browser session.

  3. Choose the verification-code option when the page presents it.

  4. Complete the email verification. The email link may open a page that displays a long code.

  5. Paste only that displayed code into the waiting terminal.

Anthropic officially documents the browser-code fallback for WSL, SSH, containers, native Windows, and terminals where the redirect or paste handoff fails. The community issue shows that the same path can also bypass this Authorize loop.

Expected result: the terminal accepts the code, reports a successful login, and /status shows the intended Claude account. A code is single-use and belongs to one authorization URL. If it expires or is rejected, discard that pair and make one new attempt instead of mixing links and codes.

Why this can work: it replaces the automatic browser callback with an explicit code handoff to the waiting CLI. It narrows the failure boundary without exposing the saved OAuth token or modifying session files.

Step 4: Separate Repeated Logout From the Authorize Loop

If login succeeds but Claude Code asks again after restart, check the documented persistence causes:

  • Make sure the system clock and time zone synchronize automatically. Token validation depends on accurate time.

  • Update Claude Code if you are on a version older than the fixes described in the current troubleshooting documentation.

  • On macOS, run claude doctor and check whether the login Keychain is locked or out of sync.

  • Close parallel sessions before another login attempt. They share saved credentials and coordinate token renewal.

  • Recheck the non-secret environment-variable names and /status. An ANTHROPIC_API_KEY can take precedence over /login.

For a general installation or update warning, follow Claude Code Auto-Update Failed? Diagnose Before Reinstalling. If you intentionally use more than one account, keep their browser and credential contexts explicit with How to Use Work and Personal Claude Code Accounts Safely.

Expected result: either the saved login survives a restart, or you have isolated the failure to clock, Keychain, account selection, environment override, or provider-side authentication.

Step 5: Stop Retrying and Escalate With Evidence

Stop after one clean reset and one manual-code attempt if the loop remains. Collect:

  • Claude Code version and installation method

  • Operating system and terminal or IDE

  • Browser and whether the session was private

  • The exact page sequence, without the authorization URL or code

  • claude doctor result with secrets removed

  • /status authentication method and account type

  • Whether the system clock is synchronized

  • Approximate UTC time of the attempt

Use /feedback when Claude Code can start, or contact Anthropic support for an account-level loop. Link the active issue if its sequence matches. Never attach the authorization URL, email link, verification code, Keychain item, token, or environment-variable value.

Common Failure Modes

Failure

Safer response

Clicking Authorize repeatedly

Create one new attempt in one clean browser context

Mixing an old URL with a new terminal

Keep each URL and code paired with its waiting process

Requesting many magic links

Stop after one controlled retry to avoid expiry and throttling

Deleting ~/.claude

Preserve settings and transcripts; use /logout once

Pasting a saved OAuth token into chat

Use the official login flow and credential store

Login succeeds but the wrong plan appears

Check /status, browser account, and API-key overrides

Private mode still loops

Try the documented manual-code handoff, then escalate

Re-login returns after every restart

Check time, Keychain, parallel sessions, and credential precedence

Why This Fix Works

The Claude account session in the browser, the one-time authorization request, the redirect or manual-code handoff, and Claude Code's saved credential are separate boundaries. Repeating Authorize inside one stale browser context tests none of them independently.

A fresh private session controls the browser state. A newly generated URL controls the authorization attempt. The manual code controls the handoff back to the waiting CLI. /status, the non-secret environment check, clock verification, and claude doctor then test whether the resulting credential is selected and stored correctly.

That structure follows the repeatable lesson from Aident's Ollama networking guide: use the exact failure wording, answer early, change one boundary at a time, state the expected result, and explain why the test narrows the cause. For OAuth failures inside an MCP server rather than Claude's own account login, use How to Fix MCP OAuth Callback Errors in Docker and WSL.

Verify One Read-Only Action Without Sharing a Key

After Claude Code authentication is stable, set up Aident Loadout by pasting:

Follow https://aident.ai/SETUP.md

Then ask:

Check my Aident Loadout account authentication and Vault status.
Search the staging capability catalog for GitHub issue search.
Return one current Action's canonical name, input schema summary,
required connection, operation type, and risk level.
Do not execute the provider Action, change a connection, or reveal a secret

Expected result: one current catalog record, zero provider executions, and no API key copied into the prompt. This verifies a real authenticated integration boundary without turning a login test into an external write.

Sources

Refresh this guide when Anthropic closes issue 77966, changes the documented manual-code flow, or updates credential persistence behavior.

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

Plug your entire stack into your AI agents.

Plug your entire stack into your AI agents.

Plug your entire stack into your AI agents.

Skip the integration headache. Plug 750+ tools into Claude Code, Codex, and OpenClaw in one go, and let your agents execute today.

Skip the integration headache. Plug 750+ tools into Claude Code, Codex, and OpenClaw in one go, and let your agents execute today.