You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] claude setup-token/CLAUDE_CODE_OAUTH_TOKEN is not enough to authenticate claude #8938
I have searched existing issues and this hasn't been reported yet
This is a single bug report (please file separate reports for different bugs)
I am using the latest version of Claude Code
What's Wrong?
I ran claude setup-token, got the token and exported in CLAUDE_CODE_OAUTH_TOKEN.
Run claude in a fresh container (where claude was never run before) with the exported token. Claude walks me through the usual startup process, theme, choice of authentication (oauth, anthropic key). I was expecting it to just start and be ready for operation
What Should Happen?
When claude is started with an exported CLAUDE_CODE_OAUTH_TOKEN it should just start without asking for authorization.
Error Messages/Logs
Steps to Reproduce
Run claude setup-token
export CLAUDE_CODE_OAUTH_TOKEN
rm -rf .claude*
claude
claude asks for theme and authentication
Claude Model
None
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.0.5 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
No response
Reacted by Igor, Ivan Khlystov, Rune Antonsen, Oliver Kuckertz, Martin O'Leary, humanik, Christoph Wiese, vec715, Junseo Park, Ryan Hughes and 16 more
I am using Docker so wanted to use the OAuth token instead of browser authorization. On my host I ran claude setup-token which gave me the token and stated: Use this token by setting: export CLAUDE_CODE_OAUTH_TOKEN= but to get claude CLI to use the token in the Docker container I needed to, instead, set ANTHROPIC_AUTH_TOKEN
The user experience when running Claude inside a container is poor. The browser authorization is not providing an option to get a code that can then be copy pasted into the Claude CLI. It is frusrtating that claude CLI asks for a code to be copied in but there is no explanatin of how/where to get this code (and it is not the OAuth token it seems.
What Should Happen?
Use the correct env variable name in the message or in the code.
Error Messages/Logs
Steps to Reproduce
Try using Claude from inside a docker container without running it on the host.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
v2.0.14
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Reacted by IT Lackey, James McKernan, henrik, Peter Baumgartner, cheolung-lee-0, Marc Jermaine Pontiveros, Anthony Ivan, Steve Strates, Willem, David Dripps and 2 more
I am running into this bug too v2.0.20. I have no way automating the authentication in the container. Even if i store the containers .claude folder via a mount it still doesn't work when i restore the container.
A) On the host run claude and login
Copy ~/.claude/.credentials.json from host into the container
B) On the host run claude setup-token
In the container: export ANTHROPIC_AUTH_TOKEN=xxx
This leads to:
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth authentication is currently not supported."},"request_id":"req_011CU8zCB1vunUftWrzbJGmC"}
Then unset ANTHROPIC_AUTH_TOKEN
Now it will use the ~/.claude/.credentials.json
Yes, copying the credentials works... it's just that CLAUDE_CODE_OAUTH_TOKEN would make life simpler. For some reason you need ~/.claude.json too, though.
Actually, CLAUDE_CODE_OAUTH_TOKEN works for interactive mode; you just need to enable hasCompletedOnboarding: true in ~/.claude.json to skip onboarding process. I use this in devcontainer and it works.
And I believe setting ANTHROPIC_AUTH_TOKEN will do the same thing to set hasCompletedOnboarding to true. That's why it works when unset ANTHROPIC_AUTH_TOKEN.
Reacted by mherbauxMLT, Junbum Lee, apache2046, biuq, SHUZHI LIU, Adam Hitchcock, forficate, David Wei and Sathvik Malali
Reacted by jp, Aleks Bykhun, NULL, Shaun Martin, Jesse Posner, 2pac, Atif Ali, Daniel Burkhalter, Blue Falcon, Martin Löper and 18 more
@chunlea I guess claude could figure that if the token is being used, no onboarding is needed.
Exactly. This issue is a bit infuriating because it involves the other level of automation during setup. With CLAUDE_CODE_OAUTH_TOKEN I can just set the token env variable, but in order to make it work I have to create or copy the claude.json file, which has to contain more then one entry (otherwise I guess it can brake something)
I tried it using the SDK (passing the `CLAUDE_CODE_OAUTH_TOKEN` env) and it worked with the onboarding flag set in the `~/.claude.json` file.
Taras Yarema
On 4 Dec 2025 at 20:12 +0100, Igor ***@***.***>, wrote:
rimmer left a comment (anthropics/claude-code#8938)
> @chunlea I guess claude could figure that if the token is being used, no onboarding is needed.
Exactly. This issue is a bit infuriating because it involves the other level of automation during setup. With CLAUDE_CODE_OAUTH_TOKEN I can just set the token env variable, but in order to make it work I have to create or copy the claude.json file, which has to contain more then one entry (otherwise I guess it can brake something)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
@chunlea I guess claude could figure that if the token is being used, no onboarding is needed.
Exactly. This issue is a bit infuriating because it involves the other level of automation during setup. With CLAUDE_CODE_OAUTH_TOKEN I can just set the token env variable, but in order to make it work I have to create or copy the claude.json file, which has to contain more then one entry (otherwise I guess it can brake something)
I use jq to configure claude.json file. code is here.
Actually, CLAUDE_CODE_OAUTH_TOKEN works for interactive mode; you just need to enable hasCompletedOnboarding: true in ~/.claude.json to skip onboarding process. I use this in devcontainer and it works.
Activity
markNZed commentedon Oct 11, 2025
What's Wrong?
I am using Docker so wanted to use the OAuth token instead of browser authorization. On my host I ran claude setup-token which gave me the token and stated: Use this token by setting: export CLAUDE_CODE_OAUTH_TOKEN= but to get claude CLI to use the token in the Docker container I needed to, instead, set ANTHROPIC_AUTH_TOKEN
The user experience when running Claude inside a container is poor. The browser authorization is not providing an option to get a code that can then be copy pasted into the Claude CLI. It is frusrtating that claude CLI asks for a code to be copied in but there is no explanatin of how/where to get this code (and it is not the OAuth token it seems.
What Should Happen?
Use the correct env variable name in the message or in the code.
Error Messages/Logs
Steps to Reproduce
Try using Claude from inside a docker container without running it on the host.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
v2.0.14
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
wiltaylor commentedon Oct 17, 2025
I am running into this bug too v2.0.20. I have no way automating the authentication in the container. Even if i store the containers .claude folder via a mount it still doesn't work when i restore the container.
markNZed commentedon Oct 17, 2025
You could try this:
samodadela commentedon Oct 23, 2025
Yes, copying the credentials works... it's just that CLAUDE_CODE_OAUTH_TOKEN would make life simpler. For some reason you need
~/.claude.jsontoo, though.chunlea commentedon Oct 24, 2025
Actually,
CLAUDE_CODE_OAUTH_TOKENworks for interactive mode; you just need to enablehasCompletedOnboarding: truein ~/.claude.json to skip onboarding process. I use this in devcontainer and it works.And I believe setting
ANTHROPIC_AUTH_TOKENwill do the same thing to sethasCompletedOnboardingto true. That's why it works when unsetANTHROPIC_AUTH_TOKEN.samodadela commentedon Nov 5, 2025
@chunlea I guess
claudecould figure that if the token is being used, no onboarding is needed.rimmer commentedon Dec 4, 2025
Exactly. This issue is a bit infuriating because it involves the other level of automation during setup. With CLAUDE_CODE_OAUTH_TOKEN I can just set the token env variable, but in order to make it work I have to create or copy the claude.json file, which has to contain more then one entry (otherwise I guess it can brake something)
tarasyarema commentedon Dec 4, 2025
chunlea commentedon Dec 7, 2025
I use
jqto configure claude.json file. code is here.fix: use env var + hasCompletedOnboarding for proper auth in Colab
fix: require browser OAuth for REPL mode authentication
8 remaining items
fix(evals): set hasCompletedOnboarding to skip TUI login prompt
feat: add OAuth token bypass for Claude Code onboarding wizard
Switch eval extractor to Claude Sonnet 4.6 via OAuth CLI subprocess
ci(agentry): prime claude-code onboarding on headless runners
Wire Sandcastle for OAuth-token auth, pnpm, Opus 4.7
Devcontainer: add Postgres service for one-command dev setup (#36)
gwonhong commentedon Jun 1, 2026
this still works well! thanks a lot 👍
Seed Claude onboarding flag so OAuth-token users skip the wizard
fix(claude/start): skip onboarding when launching with long-lived OAu…
fix(claude/start): skip onboarding when launching with long-lived OAu…
Get past Claude Code's first-run setup here too
Get past Claude Code's first-run setup on a runner
Get past Claude Code's first-run setup here too
Get past Claude Code's first-run setup here too
dtinth commentedon Sep 9, 2026
One liner command to fix with
jq: