SC26AI agents lab + dinner on the river · Nov 17
Parallel Works

pw auth

pw auth

Authenticate the CLI

Synopsis

The pw auth command signs the PW CLI in to a platform.

When the CLI knows the platform host, from the argument, --platform-host or PW_PLATFORM_HOST, or the current context, pw auth signs in through your browser exactly like pw auth login, with no key to copy. Where no browser can be opened, such as over SSH, or with --device, it prints a short code to enter on another device instead.

A browser or code sign-in keeps its long-lived part in your operating system's credential store, or in ~/.config/pw/credentials where there is none. An API key or token is saved in ~/.config/pw/credentials. Either way the sign-in is saved as a context and made the current context; manage saved contexts with pw context. Set PW_CREDENTIALS_DIR to store the credentials file somewhere else.

When no platform host is known, or the platform does not support browser sign-in yet, the CLI prompts you to paste an API key or a short-term token on a new line.

Use --with-api-key to authenticate with an API key or token instead of signing in through the browser, even when the platform host is known. The CLI prompts you to paste it, or reads it from stdin when piped, for example pw auth --with-api-key < key.txt. The key names its platform, so the flag takes no platform host.

Without the flag, piped input is also read as a credential when no platform host argument is given, for example pw auth < key.txt. Avoid passing it as an argument, which other users on a shared machine can see. For scripts and CI, you can instead set the PW_API_KEY environment variable to an API key or token; it takes precedence over the credentials file.

If your network requires an HTTP proxy to reach the platform, set the HTTPS_PROXY environment variable, for example HTTPS_PROXY=http://proxy.example.com:8080. The CLI honors the same HTTPS_PROXY, HTTP_PROXY, and NO_PROXY variables as curl and git.

On ACTIVATE, the PW CLI is pre-authenticated for user workspaces and existing clusters. You only have to authenticate if you're accessing a cloud cluster or running the PW CLI locally.

Use --context-name to specify a custom name for the context. This is useful if you want multiple contexts for the same user/server combination.

For more information about this process, please see Authentication.

pw auth [flags] [platform-host]

Examples

  pw auth cloud.parallel.works
  
  # Sign in again to the current context's platform
  pw auth
  
  # Sign in from an SSH session with a code
  pw auth --device cloud.parallel.works
  
  # Authenticate with an API key or token from a file
  pw auth --with-api-key < key.txt
  
  # Paste an API key instead of signing in through the browser
  pw auth --with-api-key

Options

      --context-name string   Name for the context (defaults to user@server)
      --device                Sign in with a code entered on another device instead of opening a browser
  -h, --help                  help for auth
      --with-api-key          Authenticate with an API key or token, pasted or piped on stdin, instead of signing in through the browser

Options inherited from parent commands

      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Overrides PW_PLATFORM_HOST environment variable and the current context's server.
  -v, --verbose                Enable verbose logging

SEE ALSO