# Sign in with credential placeholders

## Signing in when the session is logged out

If a snapshot shows a login page, never ask for or look up the password. Put
a credential placeholder where the value goes. The CLI resolves it just
before typing, and the password is redacted from all output of that session
for its lifetime, so it stays out of your context:

```bash
cofactor session fill --fields '[{"ref":"e3","value":"$CREDENTIAL(\"Admin User\").username"},{"ref":"e4","value":"$CREDENTIAL(\"Admin User\").password"}]'
cofactor session type --ref e4 --text '$CREDENTIAL("Admin User").password' --submit
```

The name is the credential's name or id; add `--application <name|id>` if two
credentials share a name. This works in any session, whether or not it was
started with `--credential`. If you work across organizations, add `--org <org>`.

Afterwards, `cofactor session save-credential` stores the fresh login for the
next session.

### Limits

- Usernames are shown, since they identify the account you are signed in as.
- Redaction prevents accidental exposure; it does not stop an agent that
  deliberately runs `cofactor credential get`. Do not do that.
- Screenshots are not redacted.
- Use the placeholder only on the credential's own login page. Typing it
  anywhere else sends the password to that page.
- "[credential redacted]" may appear in unrelated text, because matching is
  prefix-based.


### In an ADE session

Use `cofactor session start --persona <name>` instead: it signs in as a persona
the app's sandbox config declares, on the paired app copy. Credential
placeholders and `load-credential` are not available there (see the `start`
section).
