{"id":20444882,"url":"https://github.com/timo-reymann/python-oauth2-cli-auth","last_synced_at":"2025-07-07T08:05:58.572Z","repository":{"id":211575881,"uuid":"729495232","full_name":"timo-reymann/python-oauth2-cli-auth","owner":"timo-reymann","description":"Authenticate against OAuth2 Provider in Python CLIs","archived":false,"fork":false,"pushed_at":"2025-06-26T10:39:15.000Z","size":757,"stargazers_count":16,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-26T11:08:43.505Z","etag":null,"topics":["cli","oauth2","pip","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/oauth2-cli-auth/","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/timo-reymann.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":["timo-reymann"],"custom":["https://www.buymeacoffee.com/timoreymann","Buy me a coffee"]}},"created_at":"2023-12-09T12:14:33.000Z","updated_at":"2025-06-26T10:39:17.000Z","dependencies_parsed_at":"2024-01-23T18:27:57.062Z","dependency_job_id":"dfb5aacd-35de-41d7-bbab-906bed95729a","html_url":"https://github.com/timo-reymann/python-oauth2-cli-auth","commit_stats":null,"previous_names":["timo-reymann/python-oauth2-cli-auth"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/timo-reymann/python-oauth2-cli-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timo-reymann%2Fpython-oauth2-cli-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timo-reymann%2Fpython-oauth2-cli-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timo-reymann%2Fpython-oauth2-cli-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timo-reymann%2Fpython-oauth2-cli-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timo-reymann","download_url":"https://codeload.github.com/timo-reymann/python-oauth2-cli-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timo-reymann%2Fpython-oauth2-cli-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264040924,"owners_count":23548064,"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","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":["cli","oauth2","pip","python"],"created_at":"2024-11-15T10:09:35.359Z","updated_at":"2025-07-07T08:05:58.529Z","avatar_url":"https://github.com/timo-reymann.png","language":"Python","funding_links":["https://github.com/sponsors/timo-reymann","https://www.buymeacoffee.com/timoreymann","Buy me a coffee"],"categories":[],"sub_categories":[],"readme":"oauth2-cli-auth\n===\n[![LICENSE](https://img.shields.io/github/license/timo-reymann/python-oauth2-cli-auth)](https://github.com/timo-reymann/python-oauth2-cli-auth/blob/main/LICENSE)\n[![CircleCI](https://circleci.com/gh/timo-reymann/python-oauth2-cli-auth.svg?style=shield)](https://app.circleci.com/pipelines/github/timo-reymann/python-oauth2-cli-auth)\n[![GitHub Release](https://img.shields.io/github/v/tag/timo-reymann/python-oauth2-cli-auth?label=version)](https://github.com/timo-reymann/python-oauth2-cli-auth/releases)\n[![PyPI version](https://badge.fury.io/py/oauth2-cli-auth.svg)](https://pypi.org/project/oauth2-cli-auth)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/oauth2-cli-auth)\n[![codecov](https://codecov.io/gh/timo-reymann/python-oauth2-cli-auth/graph/badge.svg?token=zxY1pKcBaj)](https://codecov.io/gh/timo-reymann/python-oauth2-cli-auth)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=timo-reymann_python-oauth2-cli-auth\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=timo-reymann_python-oauth2-cli-auth)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=timo-reymann_python-oauth2-cli-auth\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=timo-reymann_python-oauth2-cli-auth)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=timo-reymann_python-oauth2-cli-auth\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=timo-reymann_python-oauth2-cli-auth)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=timo-reymann_python-oauth2-cli-auth\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=timo-reymann_python-oauth2-cli-auth)\n[![Renovate](https://img.shields.io/badge/renovate-enabled-green?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNjkgMzY5Ij48Y2lyY2xlIGN4PSIxODkuOSIgY3k9IjE5MC4yIiByPSIxODQuNSIgZmlsbD0iI2ZmZTQyZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTUgLTYpIi8+PHBhdGggZmlsbD0iIzhiYjViNSIgZD0iTTI1MSAyNTZsLTM4LTM4YTE3IDE3IDAgMDEwLTI0bDU2LTU2YzItMiAyLTYgMC03bC0yMC0yMWE1IDUgMCAwMC03IDBsLTEzIDEyLTktOCAxMy0xM2ExNyAxNyAwIDAxMjQgMGwyMSAyMWM3IDcgNyAxNyAwIDI0bC01NiA1N2E1IDUgMCAwMDAgN2wzOCAzOHoiLz48cGF0aCBmaWxsPSIjZD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CAyNGw0IDRjLTQtNS00LTExIDAtMTZsOC04YzQtNCAxMS00IDE1IDB6Ii8+PHBhdGggZmlsbD0iIzEzYWNiZCIgZD0iTTEzNCAyNDhjLTQgMC04LTItMTEtNWwtMjMtMjNhMTYgMTYgMCAwMTAtMjNMMjAxIDk2YTE2IDE2IDAgMDEyMiAwbDI0IDI0YzYgNiA2IDE2IDAgMjJMMTQ2IDI0M2MtMyAzLTcgNS0xMiA1em03OC0xNDdsLTQgMi0xMDEgMTAxYTYgNiAwIDAwMCA5bDIzIDIzYTYgNiAwIDAwOSAwbDEwMS0xMDFhNiA2IDAgMDAwLTlsLTI0LTIzLTQtMnoiLz48cGF0aCBmaWxsPSIjYmY0NDA0IiBkPSJNMjg0IDMwNGMtNCAwLTgtMS0xMS00bC00Ny00N2MtNi02LTYtMTYgMC0yMmw4LThjNi02IDE2LTYgMjIgMGw0NyA0NmM2IDcgNiAxNyAwIDIzbC04IDhjLTMgMy03IDQtMTEgNHptLTM5LTc2Yy0xIDAtMyAwLTQgMmwtOCA3Yy0yIDMtMiA3IDAgOWw0NyA0N2E2IDYgMCAwMDkgMGw3LThjMy0yIDMtNiAwLTlsLTQ2LTQ2Yy0yLTItMy0yLTUtMnoiLz48L3N2Zz4=)](https://renovatebot.com)\n[![pre-commit](https://img.shields.io/badge/%E2%9A%93%20%20pre--commit-enabled-success)](https://pre-commit.com/)\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg width=\"300\" src=\"https://raw.githubusercontent.com/timo-reymann/python-oauth2-cli-auth/main/.github/images/logo.png\"\u003e\n    \u003cbr /\u003e\n    Authenticate against OAuth2 Provider in Python CLIs\n\u003c/p\u003e\n\n## Features\n\n- Simple\n- Fancy callback page\n\n## Requirements\n\n- Python 3.9+\n\n## Installation\n\n```sh\npip install oauth2-cli-auth\n```\n\n## Usage\n\n### Simple with OIDC well known configuration endpoint\n\nThis should work for every provider supporting OIDC e.g. `gitlab.com`:\n\n```python\nfrom oauth2_cli_auth import get_access_token_with_browser_open, OAuth2ClientInfo\n\nclient_info = OAuth2ClientInfo.from_oidc_endpoint(\n    \"https://gitlab.com/.well-known/openid-configuration\",\n    client_id=\"my-client-id\",\n    scopes=[\"openid\"]\n)\n\ntry:\n    token = get_access_token_with_browser_open(client_info)\n    print(f\"Obtained token '{token}'\")\nexcept ValueError:\n    print(\"Failed to obtain token\")\n```\n\n### Simple with manual endpoint specification\n\nThe following should work for almost all use cases, for rest please check the lib docs.\n\n```python\nfrom oauth2_cli_auth import get_access_token_with_browser_open, OAuth2ClientInfo\n\nclient_info = OAuth2ClientInfo(\n    client_id=\"\u003cclientId\u003e\",\n    authorization_url=\"\u003cauthorizeUrl\u003e\",\n    token_url=\"\u003cTokenUrl\u003e\",\n    scopes=[\"scopeA\", \"scopeB\"]\n)\n\ntry:\n    token = get_access_token_with_browser_open(client_info)\n    print(f\"Obtained token '{token}'\")\nexcept ValueError:\n    print(\"Failed to obtain token\")\n```\n\n## Motivation\n\nBuilding oauth2 integration for Python apps come quite handy, especially with Gitlab integration etc.\n\nIt is a bit cumbersome to do it manually everytime, existing solutions are way to overkill to put on this problem.\nSo I created this small library without any dependencies besides the python standard library.\n\n## Documentation\n\n- [Library documentation](https://timo-reymann.github.io/python-oauth2-cli-auth)\n\n## Contributing\n\nI love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:\n\n- Reporting a bug\n- Discussing the current state of the configuration\n- Submitting a fix\n- Proposing new features\n- Becoming a maintainer\n\nTo get started please read the [Contribution Guidelines](./CONTRIBUTING.md).\n\n## Development\n\n### Requirements\n\n- Python 3.9+\n- [pre-commit](https://pre-commit.com/)\n- Poetry\n\n### Test\n\n```\npoetry run pytest .\n```\n\n### Build\n\n```sh\npoetry install\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimo-reymann%2Fpython-oauth2-cli-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimo-reymann%2Fpython-oauth2-cli-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimo-reymann%2Fpython-oauth2-cli-auth/lists"}