Answer: Generate a one-year OAuth token by running `claude setup-token`, then copy the token and set it as the `CLAUDE_CODE_OAUTH_TOKEN` environment variable. Status: Confirmed Entry: tool/claude-code/account-and-plans/generate-long-lived-token Revision: 1 Digest: sha256:b112141e9f1a72c0 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:03:17Z Last changed: 2026-11-13T03:03:17Z Last verified: 2026-11-20T12:18:07Z Next check: 2026-11-21T12:18:07Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of command | claude setup-token | [1] | 2026-11-20 token lifetime | one-year | [1] | 2026-11-20 environment variable | CLAUDE_CODE_OAUTH_TOKEN | [1] | 2026-11-20 required plan | Pro, Max, Ultra, Team, or Enterprise | [1] | 2026-11-20 Sources: [1] Anthropic. "Authentication". https://code.claude.com/docs/en/authentication.md Role: primary. Accessed: 2026-11-20T12:18:07Z Quote: "generate a one-year OAuth token with `claude setup-token`" (Supports: command) Quote: "generate a one-year OAuth token" (Supports: token lifetime) Quote: "set it as the `CLAUDE_CODE_OAUTH_TOKEN` environment variable" (Supports: environment variable) Quote: "requires a Pro, Max, Ultra, Team, or Enterprise plan" (Supports: required plan) Published: 2026-11-20T02:54:51Z Snapshot SHA-256: 60939182bd968182fbc6c1671208055560ae39c6708444fd858489c152b061f1 (captured 2026-11-20T12:18:07Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:18:07Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:18:07Z Last attempt: 2026-11-20T12:18:07Z Notes and limitations: Extracted automatically from a single official source (section "Generate a long-lived token"). Related: https://latestn.com/tool/claude-code/account-and-plans/ios-simulator-plan-availability Which Claude Code plans include the iOS Simulator pane in Desktop? https://latestn.com/tool/claude-code/account-and-plans/login-multiple-accounts How do I log in to Claude Code with multiple accounts? https://latestn.com/tool/claude-code/account-and-plans/plans-including-claude-tag Which Claude plans include Claude Tag? https://latestn.com/tool/claude-code/account-and-plans/computer-use-requirements Which plans and requirements does Claude Code computer use need? https://latestn.com/tool/claude-code/account-and-plans/desktop-app-subscription-requirements Which Claude subscription plans are required to use Claude Code in the Claude desktop app? https://latestn.com/tool/claude-code/account-and-plans/gateway-subscriptions How do Claude Code gateways interact with claude.ai subscriptions? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:03:17Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/account-and-plans/generate-long-lived-token/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/account-and-plans/generate-long-lived-token POST: https://latestn.com/dispute/tool/claude-code/account-and-plans/generate-long-lived-token with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/account-and-plans/generate-long-lived-token?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I generate a long-lived token for Claude Code? Revision 1, last verified 2026-11-20T12:18:07Z. https://latestn.com/tool/claude-code/account-and-plans/generate-long-lived-token (accessed 2026-11-21T10:06:31Z). @misc{LatestN_tool_claude_code_account_and_plans_generate_long_lived_token_r1, title = {How do I generate a long-lived token for Claude Code?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/account-and-plans/generate-long-lived-token}}, note = {Revision 1; digest sha256:b112141e9f1a72c0; last verified 2026-11-20T12:18:07Z; accessed 2026-11-21T10:06:31Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/account-and-plans/generate-long-lived-token