Skip to content
BENIBIX Learn

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.

AI⌨️ Claude Code

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.

Example
Lucy wants her GitHub job to run Claude Code on her plan. She runs claude setup-token and copies the token. Then she saves it as a secret with the name CLAUDE_CODE_OAUTH_TOKEN.
Why it matters
A job that runs at night cannot click a sign-in page. A token lets it sign in on its own.
Full entry
AI⌨️ Claude Code

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.

Example
Emma sets up a new laptop with a script. The script runs claude auth login --sso, she finishes the sign-in in the browser, and the setup goes on.
Why it matters
Setup scripts can sign in as a step, the same way every time, with no chat to open.
Full entry

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.