Skip to content

Read the API token from LARAVEL_CLOUD_TOKEN and make auth:token scriptable - #197

Merged
joetannenbaum merged 1 commit into
mainfrom
feature/laravel-cloud-token
Aug 18, 2026
Merged

Read the API token from LARAVEL_CLOUD_TOKEN and make auth:token scriptable#197
joetannenbaum merged 1 commit into
mainfrom
feature/laravel-cloud-token

Conversation

@joetannenbaum

Copy link
Copy Markdown
Collaborator

There was no way to give the CLI a token without a TTY. cloud auth needs a browser and auth:token --add always prompted, so the only option in CI was hand-writing ~/.config/cloud/config.json at a path that changes with CLOUD_BASE_URL.

The CLI now reads LARAVEL_CLOUD_TOKEN from the environment. It takes precedence over saved tokens and writes nothing to disk. An empty value counts as unset, so you can bypass it for a single command.

auth:token --add and --remove accept --token= or the token piped to stdin, and report the result as JSON when run non-interactively.

The environment holds one token, so it picks its own organization. Naming a different one with --organization now fails rather than quietly using the token's. auth and auth:token --add warn when a token you just saved is being overridden by the environment, and auth:token --list names where each token came from.

This also clears up a few non-interactive dead ends that returned a bare "Required.": adding with no token, removing a token that isn't saved, and running auth:token with no action flag.

@joetannenbaum
joetannenbaum merged commit 2ed70d3 into main Aug 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant