Auth Contexts¶
wavexis can apply an authentication context (cookies, custom headers, HTTP basic auth) loaded from a JSON file before navigating to a protected URL.
Create an auth context file¶
{
"cookies": [
{"name": "session_id", "value": "abc123", "domain": ".example.com", "path": "/"}
],
"headers": {
"X-Custom-Auth": "token-xyz"
},
"username": "admin",
"password": "secret123"
}
cookies— list of cookie objects (nameandvaluerequired)headers— extra HTTP headers sent on every requestusername/password— HTTP basic auth credentialstarget_origin— optional; rejects navigation to a different origin
Storing passwords in plain-text JSON is insecure — prefer environment variables or a secrets manager for real credentials.
Apply the context¶
The browser navigates to the URL to establish the origin, applies cookies and
headers, then navigates again. The result of document.title is printed so
you can verify the page loaded.
Screenshot after auth¶
In serve mode¶
POST /auth applies an auth context via the HTTP API (requires --base-dir):
wavexis serve --api-key secret --base-dir ./work
curl -X POST http://localhost:8080/auth \
-H "Authorization: Bearer secret" \
-H "Content-Type: application/json" \
-d '{"context": "context.json", "url": "https://example.com/dashboard"}'
The context path is resolved relative to --base-dir.