# Authentication — Respira CLI for WordPress

> How authentication works in Respira CLI. Browser handshake, OS keychain storage, RESPIRA_API_KEY environment variable for CI.

Source: https://www.respira.press/cli/docs/authentication

---

## Interactive login

```
respira auth login
```

This opens `respira.press/cli/auth` in your default browser. You sign in, the CLI receives an API key, and it's stored in your keychain under service name `respira-cli`.

## Credential precedence

1. `RESPIRA_API_KEY` environment variable (wins if set)
2. OS keychain (macOS Keychain, Windows Credential Manager, Linux libsecret)
3. `~/.respira/credentials` file fallback (used when keytar is unavailable)

## CI and automation

Create an API key in your Respira dashboard and set it as `RESPIRA_API_KEY` in your CI environment.

```
- name: audit
  env:
    RESPIRA_API_KEY: ${{ secrets.RESPIRA_API_KEY }}
  run: respira read structure https://mysite.com
```

## Check status

```
respira auth status
respira auth whoami
```

## Sign out

```
respira auth logout
```

Removes the stored key from the keychain and any fallback file.
