-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Labels
Description
Summary
The stackit auth get-access-token command currently outputs the access token to /dev/stderr instead of /dev/stdout. This behavior breaks standard CLI conventions and complicates usage in scripts and automation.
Current Behavior
-
The access token is written to stderr.
-
Capturing the token in a variable requires redirecting stderr to stdout:
export STACKIT_SERVICE_ACCOUNT_TOKEN=$(stackit auth get-access-token 2>/dev/stdout)
-
This approach also captures error messages in the variable. Example:
$ export STACKIT_SERVICE_ACCOUNT_TOKEN=$(stackit auth get-access-token 2>/dev/stdout) $ echo $STACKIT_SERVICE_ACCOUNT_TOKEN Error: get session_expires_at_unix: read from keyring: secret not found in keyring, read from encoded file as fallback: value not found
Expected Behavior
- The access token should be output to stdout.
- Users should be able to capture the token reliably with:
export STACKIT_SERVICE_ACCOUNT_TOKEN=$(stackit auth get-access-token)- On success:
- The environment variable contains the token.
- On failure:
- The environment variable remains empty.
- The error message is output to stderr.
Impact
- Automation and scripting are unnecessarily complicated.
- There is a risk of storing error messages in the environment variable instead of a valid token.
- This behavior does not align with standard CLI practices.
Suggested Fix
- Output the access token to stdout.
- Use stderr exclusively for error messages.
- Optionally, provide a flag such as
--outputto specify the output stream, if needed.
Environment
$ uname -sm
Darwin arm64
$ stackit --version
STACKIT CLI (beta)
Version: 0.26.0 (2025-03-14)