# Auth & cached login

> For the complete documentation index, see [llms.txt](/llms.txt)

Signing in at the top of every scenario is slow and brittle. Cache a logged-in
session once and reuse it.

## storageState

Point your config at a Playwright `storageState.json`:

```js
// unotest.config.mjs
export default {
  storageState: "unotest/.auth/state.json",
};
```

Scenarios then start already authenticated — no `flow_signin` per test.

## Seeding the state

Create the state once (an agent flow, or a small setup scenario that signs in and
captures cookies/localStorage). Keep the file git-ignored and refresh it when it
expires.

## When to still sign in

- Tests that specifically exercise the **login flow** itself.
- Tests that need a **different user** than the cached one — use
  [`flow_signin`](/guides/flows-and-data/) for those.

:::tip
Pair cached auth with [variables](/concepts/variables/) so the same suite runs
against dev / staging / prod with the right credentials.
:::
