Docs
Credentials

Credentials

Authenticate with password-protected pages using Basic Auth credentials.

The credentials field allows you to capture snapshots of pages protected by HTTP Basic Authentication. This is commonly used for staging environments, internal tools, and preview deployments.

Schema

FieldTypeRequiredNotes
namestringYesUsername for Basic Auth.
passstringYesPassword for Basic Auth.

How It Works

When credentials are provided:

  1. The browser sends an Authorization header with the Base64-encoded credentials
  2. The header is included in the initial page request and all subsequent requests to the same origin
  3. Protected resources (images, scripts, stylesheets) on the same domain are also authenticated

Example Request

curl -s -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://staging.example.com/"
    ],
    "viewports": [
      { "width": 1280, "height": 800 }
    ],
    "credentials": {
      "name": "staging-user",
      "pass": "staging-password"
    }
  }' \
  "https://api.watchero.io/api/v1/snapshots"

Common Use Cases

Staging Environments

Capture screenshots of password-protected staging sites before production deployment:

{
  "urls": ["https://staging.myapp.com/"],
  "credentials": {
    "name": "reviewer",
    "pass": "review-2024"
  }
}

Preview Deployments

Access branch preview URLs that require authentication (common with Vercel, Netlify, etc.):

{
  "urls": ["https://feature-branch-123.preview.myapp.com/"],
  "credentials": {
    "name": "preview",
    "pass": "auto-generated-token"
  }
}

Limitations

LimitationDescription
Basic Auth onlyForm-based login, OAuth, and cookie-based sessions are not supported.
Single originCredentials are sent only to the domain in the URL. Cross-origin resources are not authenticated.
No MFAMulti-factor authentication flows cannot be automated.

Handling Authentication Failures

If credentials are invalid or missing for a protected page, the snapshot job will fail with an error indicating the authentication issue. Check the job status response for details:

{
  "id": "cmhdgfak60002mdtxnen6g2qi",
  "status": "FAILED",
  "error": "HTTP 401 Unauthorized"
}

To troubleshoot:

  1. Verify credentials work manually with curl -u name:pass https://url
  2. Ensure the page uses HTTP Basic Auth (not form-based login)
  3. Check if the protection applies to the specific path being captured

We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking Accept, you agree to our use of cookies.
Learn more.