{"id":19169157,"url":"https://github.com/marianfoo/clientcertificate-auth-playwright","last_synced_at":"2026-06-11T23:31:20.558Z","repository":{"id":261397715,"uuid":"884189512","full_name":"marianfoo/clientcertificate-auth-playwright","owner":"marianfoo","description":"A playwright script to login using client certificates","archived":false,"fork":false,"pushed_at":"2025-02-05T09:57:21.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-01T04:25:14.601Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marianfoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-06T10:05:52.000Z","updated_at":"2025-02-05T09:57:25.000Z","dependencies_parsed_at":"2024-11-06T11:33:40.843Z","dependency_job_id":null,"html_url":"https://github.com/marianfoo/clientcertificate-auth-playwright","commit_stats":null,"previous_names":["marianfoo/clientcertificate-auth-playwright"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marianfoo/clientcertificate-auth-playwright","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianfoo%2Fclientcertificate-auth-playwright","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianfoo%2Fclientcertificate-auth-playwright/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianfoo%2Fclientcertificate-auth-playwright/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianfoo%2Fclientcertificate-auth-playwright/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marianfoo","download_url":"https://codeload.github.com/marianfoo/clientcertificate-auth-playwright/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianfoo%2Fclientcertificate-auth-playwright/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34222709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T09:45:20.618Z","updated_at":"2026-06-11T23:31:20.537Z","avatar_url":"https://github.com/marianfoo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Playwright Client Certificate Authentication\n\nA Node.js utility for authenticating using client certificates via Playwright.\n\n## Installation\n\n```bash\nnpm install playwright-client-certificate-login\n```\n\n## Usage\n\n```javascript\nconst { CertificateAuthSession } = require('playwright-client-certificate-login');\n\n// Using PFX/PKCS12 certificate\nconst options = {\n  origin: 'https://your-domain.com',\n  url: 'https://your-domain.com/path',\n  pfxPath: '/path/to/your/certificate.pfx',\n  passphrase: 'your-certificate-passphrase'\n};\n\n// Or using separate cert and key files\nconst options = {\n  origin: 'https://your-domain.com',\n  url: 'https://your-domain.com/path',\n  certPath: '/path/to/your/certificate.pem',\n  keyPath: '/path/to/your/private-key.pem',\n  passphrase: 'your-key-passphrase'\n};\n\nasync function authenticate() {\n  const session = new CertificateAuthSession(options);\n  try {\n    await session.authenticate();\n    \n    // Access authenticated session data\n    const cookies = session.getCookies();\n    const headers = session.getHeaders();\n    const browser = session.getBrowser();\n    const context = session.getContext();\n    const page = session.getPage();\n    \n    console.log('Authentication successful:', cookies);\n    \n    // Don't forget to close the session\n    await session.close();\n  } catch (error) {\n    console.error('Authentication failed:', error);\n  }\n}\n```\n\n## API Reference\n\n### Class: CertificateAuthSession\n\n#### Constructor Options\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `origin` | string | Yes | The exact origin that the certificate is valid for |\n| `url` | string | Yes | The URL to navigate to after authentication |\n| `certPath` | string | No* | Path to the certificate file in PEM format |\n| `keyPath` | string | No* | Path to the private key file in PEM format |\n| `pfxPath` | string | No* | Path to the PFX/PKCS12 certificate file |\n| `passphrase` | string | No | Passphrase for the private key |\n| `pfxBuffer` | Buffer | No* | Direct value of the PFX/PKCS12 certificate |\n| `certBuffer` | Buffer | No* | Direct value of the certificate in PEM format |\n| `keyBuffer` | Buffer | No* | Direct value of the private key in PEM format |\n| `timeout` | number | No | Timeout in milliseconds for page load (default: 30000) |\n\n\\* You must provide either:\n- `pfxPath` or `pfxBuffer`, OR\n- Both `certPath` and `keyPath`, OR\n- Both `certBuffer` and `keyBuffer`\n\n#### Methods\n\n| Method | Returns | Description |\n|--------|---------|-------------|\n| `authenticate()` | Promise\u003cvoid\u003e | Authenticates using the provided client certificate |\n| `getCookies()` | Array\u003cObject\u003e | Returns the cookies obtained after authentication |\n| `getHeaders()` | Object | Returns the headers prepared for API calls |\n| `getBrowser()` | Browser | Returns the Playwright browser instance |\n| `getContext()` | BrowserContext | Returns the Playwright browser context |\n| `getPage()` | Page | Returns the Playwright page instance |\n| `close()` | Promise\u003cvoid\u003e | Closes the browser instance |\n\n## Error Handling\n\nThe class will throw an error if:\n- Required options are missing\n- Certificate files cannot be read\n- Authentication process fails\n- Page load timeout is exceeded","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarianfoo%2Fclientcertificate-auth-playwright","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarianfoo%2Fclientcertificate-auth-playwright","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarianfoo%2Fclientcertificate-auth-playwright/lists"}