{"id":31663913,"url":"https://github.com/mgajek-cern/oidc-auth-client","last_synced_at":"2026-04-16T18:36:14.222Z","repository":{"id":318476525,"uuid":"1071433110","full_name":"mgajek-cern/oidc-auth-client","owner":"mgajek-cern","description":"Automated OIDC authentication client with PKCE support for any Keycloak or OAuth2 provider.","archived":false,"fork":false,"pushed_at":"2025-10-07T13:10:11.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-07T13:13:54.982Z","etag":null,"topics":["oidc-client","pkce-flow","playwright"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgajek-cern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-07T10:45:32.000Z","updated_at":"2025-10-07T13:13:44.000Z","dependencies_parsed_at":"2025-10-07T13:14:03.394Z","dependency_job_id":"71643e2f-501e-4677-a6d6-b64ec83d6f83","html_url":"https://github.com/mgajek-cern/oidc-auth-client","commit_stats":null,"previous_names":["mgajek-cern/oidc-auth-client"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mgajek-cern/oidc-auth-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgajek-cern%2Foidc-auth-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgajek-cern%2Foidc-auth-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgajek-cern%2Foidc-auth-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgajek-cern%2Foidc-auth-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgajek-cern","download_url":"https://codeload.github.com/mgajek-cern/oidc-auth-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgajek-cern%2Foidc-auth-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278846220,"owners_count":26056090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"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":["oidc-client","pkce-flow","playwright"],"created_at":"2025-10-07T20:51:48.046Z","updated_at":"2025-10-07T20:51:51.451Z","avatar_url":"https://github.com/mgajek-cern.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oidc-auth-client\n\nAutomated OIDC authentication client with PKCE support for any Keycloak or OAuth2 provider.\n\n## Features\n\n- 🔐 **PKCE (Proof Key for Code Exchange)** - Secure authorization code flow\n- 🤖 **Automated browser login** - No manual intervention needed\n- 🔌 **Provider agnostic** - Works with any OIDC/OAuth2 provider\n- 🎯 **Pluggable strategies** - Simple forms, EGI, or custom authentication flows\n- 🐍 **Simple API** - Easy integration in Python scripts\n\n## Prerequisites\n\nInstall [uv package manager](https://docs.astral.sh/uv/getting-started/installation/), e.g. Standalone installer for `macOS` or `Linux`:\n\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\nsource $HOME/.local/bin/env\n```\n\n## Setup\n\n```bash\nuv sync\nuv run playwright install chromium\n```\n\n## Usage\n\n### CLI\n\n**Simple form (default)**\n```bash\nuv run oidc-auth \\\n  --issuer https://keycloak.example.com/auth/realms/realm \\\n  --client-id YOUR_CLIENT_ID \\\n  --client-secret YOUR_SECRET \\\n  --username user@example.com \\\n  --password yourpassword \\\n  --headless\n```\n\n**EGI Check-in**\n```bash\nuv run oidc-auth \\\n  --issuer https://aai-dev.egi.eu/auth/realms/egi \\\n  --client-id YOUR_CLIENT_ID \\\n  --client-secret YOUR_SECRET \\\n  --username user@cern.ch \\\n  --password yourpassword \\\n  --strategy egi \\\n  --headless\n```\n\n**Run modes**\n```bash\n# Normal mode (headless browser)\nuv run oidc-auth --headless ...\n\n# Debug mode (headless browser with screenshots and verbose logging)\nuv run oidc-auth --debug --headless ...\n\n# Debug mode without headless (visible browser with screenshots and verbose logging)\nuv run oidc-auth --debug ...\n```\n\n**Results resemble**\n![](./images/result.png)\n\n\n### Python API\n\n**Simple form**\n```python\nfrom oidc_auth_client import OIDCAuthClient\n\nclient = OIDCAuthClient(\n    issuer_url=\"https://keycloak.example.com/auth/realms/realm\",\n    client_id=\"client-id\",\n    client_secret=\"secret\",\n    username=\"user@example.com\",\n    password=\"password\",\n)\n\ntokens = client.get_tokens()\nprint(tokens['access_token'])\n```\n\n**EGI Check-in**\n```python\nfrom oidc_auth_client import OIDCAuthClient\nfrom oidc_auth_client.strategies import EGIStrategy\n\nclient = OIDCAuthClient(\n    issuer_url=\"https://aai-dev.egi.eu/auth/realms/egi\",\n    client_id=\"your-client-id\",\n    client_secret=\"your-secret\",\n    username=\"user@cern.ch\",\n    password=\"password\",\n    auth_strategy=EGIStrategy(),\n)\n\ntokens = client.get_tokens()\n```\n\n**Custom strategy**\n```python\nfrom oidc_auth_client.strategies import AuthStrategy\n\nclass CustomStrategy(AuthStrategy):\n    def login(self, page, username, password):\n        page.fill('#custom-user', username)\n        page.fill('#custom-pass', password)\n        page.click('#custom-submit')\n\nclient = OIDCAuthClient(..., auth_strategy=CustomStrategy())\n```\n\n## How It Works\n\n1. **Generates PKCE** code verifier and challenge (SHA-256)\n2. **Creates authorization URL** with PKCE parameters\n3. **Automates browser login** via Playwright using selected strategy\n4. **Exchanges authorization code** for tokens using code verifier\n5. **Returns tokens** (access_token, id_token, refresh_token)\n\n## Supported Strategies\n\n- **simple** - Basic username/password form (default)\n- **egi** - EGI Check-in multi-step authentication\n- **custom** - Implement your own `AuthStrategy`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgajek-cern%2Foidc-auth-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgajek-cern%2Foidc-auth-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgajek-cern%2Foidc-auth-client/lists"}