OAuth token registration fails during automated provisioning of new instances

Resolved 💬 2 comments Opened Mar 22, 2026 by kenken64 Closed Mar 25, 2026

Description

When provisioning a new OpenClaw instance via automated CLI tooling, the Anthropic OAuth token registration step fails silently. The openclaw models auth setup-token --provider anthropic --token <TOKEN> command does not properly register the token during automated (non-interactive) provisioning flows.

Steps to Reproduce

  1. Deploy a new instance using automated provisioning (SSH-based, non-interactive)
  2. During provisioning, run the Anthropic auth setup via SSH:

``bash
openclaw models auth setup-token --provider anthropic --token "$ANTHROPIC_API_KEY"
``

  1. The command appears to succeed but the token is not persisted

Expected Behavior

The OAuth token should be registered and persisted so the gateway can authenticate with Anthropic models on startup.

Actual Behavior

The token registration does not persist. The gateway starts but cannot authenticate with Anthropic, requiring manual re-registration.

Environment

  • Claude Code version: latest (via pnpm)
  • OS: Ubuntu 22.04 (AWS Lightsail / DigitalOcean / BytePlus)
  • Node.js: v22.x
  • Provisioning: automated via SSH (non-interactive, no TTY)

Additional Context

This occurs during automated deployment where the provisioning script SSHs into the instance as the openclaw user and runs setup commands non-interactively. Other setup commands (model selection, plugin enablement, config writes) work correctly in the same context.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗