claude setup-token vs claude auth login
People think claude setup-token signs in the computer you run it on, and it does not. claude auth login signs you in here and keeps the sign-in. claude setup-token opens the browser once, then prints a token that lasts one year. It saves that token nowhere. You copy it into a CI job, or any machine with no browser.
claude setup-token Command
It makes a sign-in token for CI and scripts. It lasts one year.
claude setup-token makes a sign-in token that lasts one year, for CI jobs and scripts that have no browser. You approve it once in the browser, and the token prints in your terminal. It is not saved anywhere, so copy it and set it as CLAUDE_CODE_OAUTH_TOKEN where the job runs. It needs a Claude plan.
claude auth login Command
It signs you in from the shell. claude auth logout signs you out.
claude auth login signs you in to your Anthropic account from the shell, with no session open. Add --console to sign in with a Console account that pays by use, not a Claude plan. Add --sso to use your company's single sign-on, or --email to fill in your address. claude auth logout signs you out.
In one line
- claude setup-token Command
- It makes a sign-in token for CI and scripts. It lasts one year.
- claude auth login Command
- It signs you in from the shell. claude auth logout signs you out.