---
title: Test behind a login
description: Sign in once, save the authenticated browser session, and restore it automatically on later runs.
---

# Test behind a login

<div class="view-markdown-wrapper">
<ViewMarkdown />
</div>

For applications that require authentication, your coding agent can sign in once and save the browser session. Later runs restore the saved session automatically instead of repeating the login flow.

**First run — log in and save:**

```
/shiplight verify http://localhost:3000/dashboard — log in with
test@example.com / password123
```

**Later runs — reuse the saved session:**

```
/shiplight verify http://localhost:3000/dashboard loads correctly
```

## How Shiplight reuses the session

Shiplight creates a storage state file that your coding agent reuses across browser sessions.

If the saved session expires and the application redirects to the login page, the agent asks you to sign in again and saves the new session. To configure or repair authentication directly, run **`/shiplight auth`**. This command manages authentication for both interactive browser sessions and authored tests.

## Choose another authentication method

| Situation           | Use                                                                                                  |
| ------------------- | ---------------------------------------------------------------------------------------------------- |
| OAuth, SSO, or 2FA  | Use a [persistent Chrome profile](/guides/persistent-chrome-profile) and complete the login manually |
| Tests running in CI | Use saved storage state for the CLI. See [Authentication](/local/agent-workflow/authentication)      |
