Authenticated Website Screenshot: define the result before the browser
Authenticated website screenshot and screenshot behind login describe a security problem before they describe a rendering problem. A screenshot service needs a reachable page state, while the application must prevent that access path from becoming a reusable link to private data.
Snapshot Site does not document general cookie injection, arbitrary target Authorization headers, or an interactive login sequence. An architecture should not invent those capabilities. Two honest patterns remain: issue a purpose-built short-lived preview URL, or use a programmable browser inside an authorized environment.
A preview route is appropriate when the application controls the content and can render one scoped document from a signed token. Browser automation is appropriate when the state can only be reached through login, MFA, role selection, or several interactive steps.
A production workflow
The screenshot is sensitive data. The access mechanism, target validation, output storage, expiry, and audit trail matter as much as the rendering call. A useful implementation separates request creation, browser work, result validation, storage, and downstream review. That separation makes failures observable and prevents a rendering option from becoming undocumented business logic.
- Confirm authorization to capture and retain the content.
- Create a scoped expiring preview URL when supported.
- Send that URL from a trusted backend.
- Store the artifact with restricted access and retention.
For private-page evidence, store the application record, access method, token expiry, viewport, capture settings, and timestamp without persisting reusable credentials. Reviewers need provenance, not a copied authentication secret.
Controls that determine the output
Scope
A preview token should authorize one document or narrow resource set, not the entire account area.
Expiry and replay
Keep lifetime short, record issuance and use, and decide whether a token may be used more than once.
Output sensitivity
Generated screenshots and PDFs inherit the sensitivity of the source page. Restrict storage, sharing, logs, and retention accordingly.
Auditability
Record who requested the capture, which source was authorized, when it ran, and where the result was stored.
Security and product boundary
Do not bypass access controls, CAPTCHA, MFA, robots policy, or contractual restrictions. Capture only content your organization is authorized to process, and use a browser automation environment when the page cannot be exposed safely by URL.
Authorize the capture before minting a preview, limit the signed state to one purpose and short lifetime, and redact it from shared diagnostics. Restrict the generated screenshot at least as tightly as the account page or report it represents.
Production checklist
- Document the legal and product authorization.
- Use a scoped expiring preview where possible.
- Keep both API and preview secrets out of logs.
- Restrict generated asset access.
- Delete temporary previews and artifacts on schedule.
Review screenshot API authentication for the service boundary, the Playwright guide for interactive login, and pricing after defining the authorized capture volume.