Command reference ยท Claude Code
/login
Signs in to your Anthropic account.
/login starts the sign-in process for your Anthropic account. On the very first start of Claude Code, a browser window opens automatically for this; after that, you can call /login manually at any time, for example to sign in again after a /logout or to switch accounts. Supported are Claude Pro/Max, Claude for Teams/Enterprise, the Claude Console, cloud providers such as Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry (via environment variables or the "3rd-party platform" option in the login prompt), as well as a self-hosted Claude Apps Gateway via enterprise SSO.
If the browser doesn't open automatically, press c to copy the login URL to the clipboard. If the browser shows a code instead โ common with WSL2, SSH sessions, or containers โ paste it directly into the terminal. Once complete, the terminal reports "Login successful". If an existing login expires in less than three days, Claude Code warns you on startup and recommends /login to renew it.
โ WHEN TO USE IT?
First sign-in on a new machine
After installation, start claude in the terminal and run /login to connect to your Claude account via browser.
Renew an expiring login
When you see the message 'Your login expires in 3 days ยท run /login to renew', simply run /login to extend the login without interrupting the current session.
โ WHEN NOT TO?
Just wanting to check the current login status
/login starts a new login flow directly instead of just displaying information.
Better: Use /status โ among other things, it shows a login line with account and expiration status.
Work via API key or your own credential script
ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, or apiKeyHelper operate independently of the /login flow and take precedence over subscription login in the auth order.
Better: Set the appropriate environment variable or configure apiKeyHelper instead of logging in via /login.
SOURCES
- Claude Code docs (official) โ code.claude.com
MORE COMMANDS ยท Claude Code