Workers - Work across multiple accounts with Wrangler auth profiles
Key Points
- Named auth profiles bound to directories
- Automatic account switching by directory
- CLOUDFLARE_API_TOKEN overrides profiles in CI
Summary
Wrangler CLI now supports named auth profiles: OAuth logins bound to directories so the CLI automatically chooses the right Cloudflare account based on the directory you’re working in. Profiles let you keep separate logins for different clients or separate staging/production accounts and reduce accidental cross-account operations when paired with an account_id in your Wrangler config.
Key Points
- Create and activate a profile for each account:
wrangler auth create <name>thenwrangler auth activate <name> <path>to bind it to a directory (applies to that directory and its subdirectories). - Pair a profile with
account_idin yourwrangler.tomlto prevent commands from reaching the wrong account. - Override directory selection for a single command with
--profile, e.g.wrangler deploy --profile personal. - In CI/automation,
CLOUDFLARE_API_TOKENstill takes precedence over profiles; use tokens for non-interactive environments. - See the Authentication profiles docs for setup details and the full resolution order.