token

dpsctl auth token Usage Guide

Print the current stored access token to stdout.

Overview

The auth token command attempts to load credentials from the configured credentials file and refresh them if necessary. If a valid access token is available, the command prints the token to stdout. If no token is available, the command exits with an error.

This command is useful for scripting or debugging workflows that need the current DPS access token.

Usage

dpsctl auth token

Flags

Includes global dpsctl options.

   --help, -h  show help

Examples

$ dpsctl auth token
eyJhbGciOi...

Use a Custom Credentials File

$ dpsctl --credentials-path /path/to/credentials.yaml auth token
eyJhbGciOi...

Capture Token for a Script

$ ACCESS_TOKEN="$(dpsctl auth token)"

No Token Available

$ dpsctl auth token
{
  "status": {
    "diag_msg": "Command execution failed with an error",
    "error": {
      "code": "CLIENT_ERROR",
      "error": "no access token available"
    },
    "ok": false
  }
}

Notes

  • The command writes only the access token to stdout when successful.
  • Before printing, the command attempts to load and refresh credentials using the configured credentials file.
  • Global connection and TLS options, such as --host, --port, --resolve, --insecure, --insecure-tls-skip-verify, and --ca-cert-path, can affect credential refresh.
  • The command returns a structured error when no access token is available.
  • Tokens are sensitive credentials. Avoid printing them in shared logs or terminal recordings.