# pw auth login

> Source: https://parallelworks.com/docs/cli/pw/auth/login

## pw auth login

Sign in through the browser or with a code

### Synopsis

**pw auth login** signs the CLI in with your normal platform sign-in, including single
sign-on and two-step verification, so no API key has to be copied.

By default it opens your browser and listens on **127.0.0.1** for the result. Where no browser
can be opened, such as over SSH or without a display, or with **--device**, it prints a short
code instead: open the address it shows on any device, enter the code, and check that the
page names this computer before you approve it.

The CLI stays signed in while you use it and renews its access automatically. The long-lived
part is kept in your operating system's credential store where there is one, and otherwise in
**~/.config/pw/credentials**. Each signed-in computer is listed under **Settings** >
**Connected apps**, where it can be signed out. **pw auth logout** signs this computer out.

The platform host defaults to the current context's host. **pw auth** runs the same sign-in
when it knows the platform host. For scripts and CI, keep using an API key piped to **pw auth**
or set in **PW_API_KEY**.

```
pw auth login [flags] [platform-host]
```

### Examples

```
  # Sign in to the current context's platform through the browser
  pw auth login
  
  # Sign in to a platform for the first time
  pw auth login cloud.parallel.works
  
  # Sign in from an SSH session with a code
  pw auth login --device cloud.parallel.works
```

### 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 login
```

### 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

* [pw auth](/docs/cli/pw/auth)	 - Authenticate the CLI
