rspm create token

Advanced

Command to create tokens. The token will be written to stdout. Informational messages are written to stderr

Terminal
rspm create token [flags]

Examples

Terminal
  rspm create token --scope=sources:write --sources=* --description="Allows all sources" --user="admin@example.com"
  rspm create token --scope=sources:write --sources=source1,source2 --expires=20d --description="20 day token" --user="user1@example.com"
  rspm create token --scope=sources:write --sources=source1,source2 --expires=5h --description="5 hour token" --user="user2@example.com"
  rspm create token --scope=sources:write --sources=source1,source2 --expires=never --description="token that never expires" --quiet --user="app-automation"
  rspm create token --scope=repos:read --repos=repo1,repo2 --expires=never --description="Repo read token with no expiration" --user="service-account"
  rspm create token --scope=blocklist:admin --expires=20d --description="20 day blocklist token" --user="admin@example.com"
  rspm create token --scope=metadata:admin --expires=20d --description="20 day metadata token" --user="metadata-service"
  rspm create token --scope=global:admin --expires=never --description="Allows global admin access" --user="admin@example.com"

  # Create a repos:read token with access to download packages from all repos (no expiration)
  rspm create token --scope=repos:read --repos='*' --description="Allows read access for all repos" --user="ci-system"

  # Create a sources:write token with access to upload packages to all sources (no expiration)
  rspm create token --scope=sources:write --sources='*' --description="Allows write access for all sources" --user="package-publisher"

  # Create a sources:write token with access to upload packages to the internal and internal-git sources (no expiration)
  rspm create token --scope=sources:write --sources=internal,internal-git --description="Allows write access for the internal and internal-git sources" --user="internal-publisher"

  # Create a blocklist:read token with read access to the blocklist (1 day expiry)
  rspm create token --scope=blocklist:read --expires=1d --description="1 day blocklist read-only token" --user="security-scanner"

Options

Terminal
      --description string   The description for this token. Required.
      --expires string       The expiry for the token. Provide a value that specifies units in 's', 'm', 'h', or 'd'. A value of 'never' creates a token that never expires. Defaults to 'never' (default "never")
  -h, --help                 help for token
  -q, --quiet                Output the token only.
      --repos strings        For repos tokens, a comma-separated list of repository names to which this token will be granted access. Use '*' to allow all repos.
      --scope string         Specify the token type and access. Options are: 'sources:write', 'repos:read', 'blocklist:admin', 'blocklist:read', 'metadata:admin', 'global:admin'
      --sources strings      For sources tokens, a comma-separated list of source names to which this token will be granted access. Only works for Git and Local sources. Use '*' to allow all sources.
      --user string          A user to associate with this token. Typically set to an email of a user or name of an application if used for automation. This value is used in the 'sub' field of the generated token, and is used to audit token usage in logs. Required.

Options inherited from parent commands

Terminal
  -a, --address string             The address of the remote server. If not specified, the PACKAGEMANAGER_ADDRESS environment variable is used.
  -c, --config string              Path to config file
      --insecure-ssl-skip-verify   If true, skip SSL certificate validation. This reduces the security that SSL normally provides.
  -o, --output-format string       Specify the output format 'human' for human-readable output or 'json' for JSON-encoded output. (default "human")
  -v, --verbose                    Provide additional output
Back to top