OmniscioGuidesHow to sign in to Claude Code
How do you sign in to Claude Code?
Signing in is the one step that decides who pays for every token after it. Claude Code supports a subscription, a Console organization, a cloud provider and a raw API key, and it decides between them by a documented precedence rather than by which one you set most recently.
This page covers all of them: the first login, each account type, which credential wins, and how to see when a login expires. A sign-in that fails is the error guides' job — the login errors guide and the five pages beside it cover every one of those messages, and this page links there rather than repeating their fixes.
Last checked against Anthropic's Claude Code documentation on November 21, 2026. By the Omniscio team. Updated .
On this page
- Log in the first time
- The account types it accepts
- Signing in with a Console account
- API keys, helpers and long-lived tokens
- Which credential wins
- Seeing when a login ends, and renewing it
- Log out, or switch accounts
- When the sign-in fails, or the prompt comes back
- For admins: restricting sign-in
- Where these answers come from
Log in the first time
After installing Claude Code, run claude in your terminal. On first launch it opens a browser window for you to log in. It can skip the prompt in cases such as these:
- You set
ANTHROPIC_API_KEYand approve the key when Claude Code asks whether to use it. - You already signed in earlier with
claude auth loginin your shell.
If the browser does not open by itself, press c to copy the login URL to your clipboard and paste it into the browser. If the browser shows you a login code instead of redirecting back, paste that code into the terminal at the Paste code here if prompted prompt.
When login completes, the terminal shows Login successful and asks you to press Enter to continue. Claude Code stores the login, so the next session doesn't ask again until it expires.
New to Claude Code entirely? The quickstart covers the install and the first session around this sign-in.
Source: "Log in to Claude Code" in Anthropic's Authentication page, read November 21, 2026.
The account types it accepts
Anthropic lists the account types Claude Code accepts, and what each one signs you in to:
- Claude Pro, Max or Ultra subscription — log in with your claude.ai account. Subscribe at claude.com/pricing.
- Claude for Teams or Enterprise — log in with the claude.ai account your team admin invited you to.
- Claude Console — log in with your Console credentials. Your admin has to invite you first, and you can sign in with or without creating an API key.
- Cloud providers — Amazon Bedrock, Google Cloud's Agent Platform (the service still called Vertex AI) or Microsoft Foundry. Set the required environment variables before running
claude, or choose 3rd-party platform at the login prompt to launch an interactive setup wizard for Bedrock and Agent Platform. - Cloud gateway — if your organization runs a self-hosted Claude apps gateway, you sign in with corporate SSO. At first launch the gateway is offered at the login prompt; inside a running session,
/loginopens the same Cloud gateway screen. The gateway-issued token is then the session's only credential. - Enterprise Admin Console — if an Owner turned on this sign-in for your organization, run
claude auth loginand select your organization in the browser. Look forSigned in to the organizationin the terminal to confirm.
To use a cloud provider end to end, the Bedrock and Vertex setup guide covers the environment variables and the credentials each provider needs.
Source: "Log in to Claude Code" in Anthropic's Authentication page, read November 21, 2026.
Signing in with a Console account
For organizations billed by API usage, access runs through the Claude Console. An admin creates or reuses the Console account, invites users from the Members page at platform.claude.com/settings/members, or sets up SSO, and assigns each invitee one of two roles: Claude Code, who can only create Claude Code API keys, or Developer, who can create any kind of API key. Each invited user then accepts the invite, installs Claude Code and logs in with their Console credentials.
Since v2.1.242 there is a sign-in that creates no API key at all, which matters on a team that does not let developers create them. Choose the Anthropic Console account at the login prompt and Claude Code asks how you want to sign in:
- Sign in with your Console account, marked
(recommended): Claude Code keeps the OAuth token and stores it as an Anthropic profile. No API key is created. - Create an API key, marked
(legacy): Claude Code creates a Console API key and stores it with your other credentials.
The difference is how each one lives: a profile holds an OAuth login that Claude Code refreshes automatically, and an API key is a static credential. When a profile's refresh fails, requests fail until you sign in again. Unset ANTHROPIC_API_KEY before you use the sign-in that creates no key, because an approved key would be preferred over the new profile.
The keyless option is hidden in these cases: running against a cloud provider; any settings file sets forceLoginOrgUUID or sets forceLoginMethod to "claudeai"; forceLoginMethod is "console" with no forceLoginOrgUUID, until you retry from the error screen after a failed sign-in; or a managed settings source exists that Claude Code cannot read.
Sources: "Claude Console authentication" and "Sign in without an API key" in Anthropic's Authentication page, read November 21, 2026.
API keys, helpers and long-lived tokens
Three of the programmatic routes, and they are not interchangeable.
An API key in the environment. Set ANTHROPIC_API_KEY and, in interactive mode, approve the key once when Claude Code asks; your choice is remembered. To change it later, use the Use custom API key toggle in /config, which appears only while the variable is set. In non-interactive mode (claude -p) the key is always used when present. Use this for direct Anthropic API access with a key from the Claude Console.
A script that returns a key. The apiKeyHelper setting runs a shell script and uses its output, for dynamic or rotating credentials such as a short-lived token fetched from a vault. If the script takes longer than 10 seconds, Claude Code shows the elapsed time in the prompt bar. If it exits with an error, times out or prints nothing, your requests fail after at most three attempts, and the failure names the helper script.
A one-year OAuth token. For CI pipelines and scripts with no browser, run claude setup-token. It opens the same browser authorization as /login, prints the token to the terminal after you approve access, and saves it nowhere — copy it and set it as CLAUDE_CODE_OAUTH_TOKEN wherever you need to authenticate:
export CLAUDE_CODE_OAUTH_TOKEN=your-tokenThat line is for macOS, Linux and WSL. In Windows PowerShell set the same variable with $env:CLAUDE_CODE_OAUTH_TOKEN = "your-token"; in Command Prompt, set CLAUDE_CODE_OAUTH_TOKEN=your-token.
The environment variables guide covers the other variables Claude Code reads, and the error page for a failing apiKeyHelper script starts from the message you see when one breaks.
Sources: "Credential management" and "Generate a long-lived token" in Anthropic's Authentication page, read November 21, 2026.
Which credential wins
When several credentials are present, Claude Code chooses in this documented order:
- Cloud provider credentials, when
CLAUDE_CODE_USE_BEDROCK,CLAUDE_CODE_USE_VERTEXorCLAUDE_CODE_USE_FOUNDRYis set. ANTHROPIC_AUTH_TOKEN, sent as a bearer token — the route for an LLM gateway (a proxy that stands in front of the API) which authenticates with bearer tokens rather than Anthropic API keys.ANTHROPIC_API_KEY, sent as an API key header — direct Anthropic API access with a Console key.- An
apiKeyHelperscript's output, for dynamic or rotating credentials. CLAUDE_CODE_OAUTH_TOKEN, the long-lived token fromclaude setup-token.- Anthropic profiles and federation credentials.
- The subscription login from
/login— the default for Pro, Max, Ultra, Team and Enterprise users.
A signed-in Claude apps gateway session sits outside that list. When one exists it is the credential the CLI uses — even if a cloud provider variable is set, and none of the sources above are used.
One rule worth checking against your own machine: an active subscription plus ANTHROPIC_API_KEY in your environment means Claude Code uses the API key once you approve it, which can fail if that key belongs to a disabled or expired organization. Run unset ANTHROPIC_API_KEY to fall back to the subscription, and check /status to confirm which method is active — when both exist, it marks the one not in use.
Source: "Authentication precedence" in Anthropic's Authentication page, read November 21, 2026.
Seeing when a login ends, and renewing it
Run this in your shell to see when the claude.ai login you are using ends:
claude auth status --textSign in again with /login or claude auth login before the earlier date the command prints; using Claude Code does not extend the login. The command gives a range rather than a single date — the earliest and the latest day the login can end, as in Sign-in ends: between 2026-11-20 and 2026-11-23 (2026-11-23T17:04:11.000Z) — so the earlier date is the one to act on. If the line says any day now or may have ended, sign in now. The line is absent for credentials that are not a claude.ai login, or when no date is known.
One more warning arrives in scripts: when the later date is under 10 days away, a claude -p run with text output prints Warning: this sign-in on stderr.
Starting on the earlier of those two end dates — the first day the login could die — Claude Code warns at startup: Your login expires in 3 days · run /login to renew. Run /login then. The warning appears only when a claude.ai login is the active credential.
Once a login expires and cannot be refreshed, requests fail with the login time limit or login expired errors until you sign in again, unless another saved credential can take over. /status shows a Login row reading Expired — log in again before a request fails.
Renewing early matters most for unattended sessions: a Remote Control session that outlives the login disconnects until you sign in again, and a background session in agent view stops making progress with no other saved credential.
Sources: "Check when a stored login ends" and "Renew an expiring login" in Anthropic's Authentication page, read November 21, 2026.
Log out, or switch accounts
Type /logout at the Claude Code prompt to log out and re-authenticate. Logging out also resets your first-launch setup state, so the next time you run claude it walks you through login and setup again. For a sign-in that wrote an Anthropic profile — a saved OAuth credential Claude Code manages — /logout removes and revokes that credential. A profile written by Anthropic's separate ant command-line client is removed with ant auth logout instead.
To stay signed in to two accounts at once — work and personal, say — give each account its own configuration directory and point CLAUDE_CONFIG_DIR at the one you want before starting claude. Each directory keeps its own settings, session history, and claude.ai login or API key. The exception is two Console sign-ins that created no API key: Claude Code stores that kind of sign-in outside the configuration directory, so separate directories do not keep them apart. The multiple accounts guide covers the aliases, the switcher tools and what each route does with credentials.
Sources: "Log in to Claude Code" and "Log in with multiple accounts" in Anthropic's Authentication page, read November 21, 2026.
When the sign-in fails or the prompt comes back
Those messages have their own guides, one per message, and each starts from the exact text on screen rather than from the account setup this page covers. The login errors guide is the way in; the pages beside it are the specific failures:
- Login reached its time limit.
- Too many login attempts.
- Couldn't save your login.
- Failed to refresh the OAuth token.
- Not signed in to the Cloud gateway.
One cause is configuration rather than a failure message: an administrator's managed settings can require a particular login method or organization. Where those settings come from is the managed settings guide's subject.
Source: "Login prompt still appears after an earlier sign-in" in Anthropic's Authentication page, read November 21, 2026.
For admins: restricting sign-in
An organization can require a particular login method or organization, set with forceLoginMethod and forceLoginOrgUUID in managed settings. Anthropic documents the consequences — an error for a login to another organization, and an exit at startup — and setting forceLoginOrgUUID for a Console organization also removes the keyless sign-in option described above, so deploy it only after every developer has a role that can create API keys. How a policy like that reaches a machine is the managed settings guide.
Sources: "Restrict login to your organization" and "Stop offering the keyless sign-in on managed machines" in Anthropic's Authentication page, read November 21, 2026.
One sign-in, many sessions
Each Claude Code session runs on one account. Omniscio, the desktop app we make for running many sessions at once, puts them all in one window, so you can see which are working and which are waiting on you.
It is free to use with up to 8 projects. Pro is $20/month or $192/year, and neither plan includes an AI allowance: sessions run on your own account or key, billed by that provider.
The multi-session guide compares the ways to run several sessions, and the quickstart covers the first session this login starts.
Where these answers come from
- Anthropic, Authentication: the first login and its browser flow, every account type, the Console roles and the keyless sign-in, credential storage, the long-lived token, the precedence order, login expiry, logging out and multiple accounts, the login-prompt causes, and the organization restrictions. Read November 21, 2026.
- Anthropic, Settings reference: the
apiKeyHelperandforceLoginMethodsettings named on this page. Linked, not quoted. - Anthropic, Troubleshoot installation: the login and authentication troubleshooting section. Linked, not quoted.
Every command, environment variable, setting name and message string on this page is Anthropic's own, quoted from the Authentication page as it read on the date above. No account was signed in to for this page.
Common questions
How do I log in to Claude Code?
Run claude in your terminal. On first launch Claude Code opens a browser window to log in; if the browser does not open, press c to copy the login URL and paste it into your browser. When login completes the terminal shows Login successful. If your browser shows a login code instead of redirecting back, paste it into the terminal at the Paste code here if prompted prompt.
Can I use Claude Code without a subscription?
Yes. Claude Code accepts a Claude Console account, including a Console sign-in that creates no API key, and it accepts a cloud provider such as Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry. You can also set an ANTHROPIC_API_KEY environment variable and approve the key when Claude Code asks.
Why does Claude Code still ask me to log in after I signed in?
Those messages have their own guides: the login errors guide is the way in, and the pages beside it cover each specific failure, starting from the exact text on screen.
Which credential does Claude Code use when I have more than one?
Cloud provider credentials come first, then ANTHROPIC_AUTH_TOKEN, then ANTHROPIC_API_KEY, then an apiKeyHelper script, then CLAUDE_CODE_OAUTH_TOKEN, then Anthropic profiles and federation credentials, and last the subscription login from /login. Run /status to see which one is active; when a login and an API key both exist it marks the one not in use.
How do I log out of Claude Code?
Type /logout at the Claude Code prompt. Logging out also resets your first-launch setup state, so the next time you run claude it walks you through login and setup again. To stay signed in to two accounts at once, give each account its own CLAUDE_CONFIG_DIR.
Signed in. Now run every session in one window
Omniscio runs Claude Code sessions side by side and shows you each one. The features page lists what it does today.