Capture a page behind a login
Declare a login and complete authentication in the correct browser session.
A route names its necessary login. Fruitful tests the session before capture. If the session is missing, the user must sign in. The package never receives credentials or cookies. Before capture, follow the private evidence rules.
Declare the login
Define logins in capture.logins[].
Routes refer to them by ID:
"logins": [
{
"id": "linkedin",
"name": "LinkedIn",
"reason": "LinkedIn captures need a logged-in browser session.",
"checkUrl": "https://www.linkedin.com/in/me/",
"signInUrl": "https://www.linkedin.com/login",
"signedIn": {
"selectors": ["[data-testid=\"mainFeed\"]", "section[data-view-name=\"profile-card\"]"]
},
"signedOut": {
"reason": "LinkedIn redirected to a sign-in or checkpoint page.",
"urls": [{ "pattern": { "hostname": "*.linkedin.com", "pathname": "/login*" } }],
"html": ["id=\"rememberme-div\""]
}
}
]- Fruitful loads
checkUrlto test the session. - Fruitful opens
signInUrlwhen the user must sign in. - Any matching
signedIncondition can identify a ready session. signedOuttests the final URL or HTML for a signed-out session.- The user sees the
signedOut.reasontext when it matches.
A matcher can test urls, CSS selectors, or literal html substrings.
Use different reliable conditions when the site has different sign-in paths.
Attach the login to a route
{ "id": "newsfeed", "kind": "collection", "login": "linkedin", "runsOn": ["desktop"], "binding": "newsfeed" }This route uses the local signed-in browser.
The registry rejects a reader or media route that has a login and lists cloud.
Capture stops with LoginRequired if signedOut matches or signedIn does not match.
Complete the authentication checkpoint
The CLI and MCP share a capture service, but their session lifetimes differ:
| Host | Behavior after LoginRequired |
|---|---|
| Interactive CLI | The command waits for sign-in and confirmation within the same process. |
| Non-interactive CLI | The command returns a failure and cancels the pending session during cleanup. |
| MCP | The tool returns a session ID. The host retains the session until completion, cancellation, expiry, or host termination. |
A later CLI invocation cannot resume the previous command's pending session.
Rerun capture interactively if authentication is necessary.
--headless does not provide an interactive login window.
For an MCP checkpoint:
- Keep the returned
authSessionId. - Tell the user the target URL and the reason for the checkpoint.
- Ask the user to sign in through the already-open Chrome window and leave that window open.
- Keep the authoring task pending until the user says the session is ready.
- Call
resume_capturewith the same session ID. - Use
assess_captureto make sure the capture contains the expected page.
If login is still necessary, repeat the checkpoint.
If the task ends, call cancel_auth_session.
Do not author from a login page or silently substitute an old fixture.
If the user cannot sign in, get agreement before you reduce the task to a repair with existing fixtures.
Give that reduced evidence scope in the result.
Never request passwords or two-factor codes. Do not keep a capture tool call open while you wait for the user. Do not repeatedly poll the login page or start another browser against the same profile.
Import an existing browser session
Use this path only when the user explicitly chooses to reuse their normal browser session:
- Use
list_browser_sessionsto find available profile and domain metadata. - Name the source profile and target domains before import.
- Get explicit consent for that profile and those domains.
- Use
import_browser_sessionfor the active authentication session. - Resume capture after import.
The listing does not expose cookie values or access Keychain. The import uses only the permitted domains. The user enters a laptop password only in the macOS Keychain prompt. Never request, read, repeat, or log that password or decrypted cookie values.
Profile contention
For ChromeProfileInUse, ask the user to close only the unrelated window named by the error.
Keep an MCP-managed login window open.
Resume that window through its authSessionId.
Reference: login, sessionMatcher.