{"id":18349061,"url":"https://github.com/jpmanson/easyoidc","last_synced_at":"2026-01-31T19:05:23.938Z","repository":{"id":219189422,"uuid":"744752367","full_name":"jpmanson/EasyOIDC","owner":"jpmanson","description":"Easy integration with OIDC (OpenID Connect) authentication servers. Examples in Flask, NiceGUI and Taipy web frameworks","archived":false,"fork":false,"pushed_at":"2024-05-24T22:47:18.000Z","size":63,"stargazers_count":14,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-27T17:49:48.795Z","etag":null,"topics":["flask","nicegui","oauth2","oauth2-client","oidc","oidc-client","taipy"],"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/jpmanson.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}},"created_at":"2024-01-17T23:49:19.000Z","updated_at":"2025-10-29T13:01:24.000Z","dependencies_parsed_at":"2024-01-26T00:20:18.603Z","dependency_job_id":"324d34b8-cafa-4fd3-b478-5fc040c7e70d","html_url":"https://github.com/jpmanson/EasyOIDC","commit_stats":null,"previous_names":["jpmanson/easyoidc"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/jpmanson/EasyOIDC","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpmanson%2FEasyOIDC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpmanson%2FEasyOIDC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpmanson%2FEasyOIDC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpmanson%2FEasyOIDC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpmanson","download_url":"https://codeload.github.com/jpmanson/EasyOIDC/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpmanson%2FEasyOIDC/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28950352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["flask","nicegui","oauth2","oauth2-client","oidc","oidc-client","taipy"],"created_at":"2024-11-05T21:20:14.561Z","updated_at":"2026-01-31T19:05:23.933Z","avatar_url":"https://github.com/jpmanson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Introduction\n\nEasyOIDC is a Python library that provides a simple interface to the [OpenID Connect](https://en.wikipedia.org/wiki/OpenID#OpenID_Connect_(OIDC)) protocol. It is designed to be easy to use and to integrate into existing applications. It is built on top of the Authlib library.\n\nEasyOIDC can basically adapt to any web framework that supports session variables, route definition, and redirection. As an example, integration examples with [Flask](https://github.com/pallets/flask), [NiceGUI](https://github.com/zauberzeug/nicegui/), [Streamlit](https://github.com/streamlit/streamlit) and [Taipy](https://github.com/Avaiga/taipy) are provided.\n\nIn addition, the library has high-level classes, to integrate even more easily with [Flask](https://github.com/pallets/flask), [NiceGUI](https://github.com/zauberzeug/nicegui/) and [Taipy](https://github.com/Avaiga/taipy). The idea of the project is to gradually incorporate high-level support for new web frameworks from the Python world.\n\nEasyOIDC has been tested with OIDC backends such as [Keycloak](https://www.keycloak.org/), [Google](https://developers.google.com/identity/openid-connect/openid-connect?hl=es-419) and [Auth0](https://auth0.com/), and could connect to virtually any [OpenID Connect](https://en.wikipedia.org/wiki/OpenID#OpenID_Connect_(OIDC)) compatible server.\n\n## Installation\n\nThe library is available via PyPi (https://pypi.org/project/EasyOIDC/)\n\n```bash\npip install easyoidc\n```\n\nIf you are going to use it with a specific web framework, you can install it like this: \n```bash\npip install easyoidc[flask]\npip install easyoidc[nicegui]\npip install easyoidc[taipy]\n```\n\n## Usage\n\n### Flask\nThis is an example of how to integrate EasyOIDC with Flask:\n\n```python\nfrom flask import Flask\nfrom EasyOIDC import Config, SessionHandler\nfrom EasyOIDC.frameworks.flask import FlaskOIDClient\n\napp = Flask(__name__)\nsession_storage = SessionHandler(mode='redis')\nauth_config = Config('.env')\nauth = FlaskOIDClient(app, auth_config=auth_config, session_storage=session_storage)\n\n@app.route('/')\ndef root():\n    is_authenticated = auth.is_authenticated()\n    if is_authenticated:\n        userinfo = auth.get_userinfo()\n        return f\"Welcome to the Flask app with Middleware!.\u003cbr\u003eUser authenticated={is_authenticated}\u003cbr\u003e{userinfo}\u003cbr\u003e\u003ca href='/logout'\u003eLogout\u003c/a\u003e\"\n    else:\n        return f\"Welcome to the Flask app with Middleware!.\u003cbr\u003e\u003ca href='/login'\u003eLogin\u003c/a\u003e\"\n\n\nif __name__ == \"__main__\":\n    app.run()\n```\n\n### NiceGUI\nThis is an example of how you can integrate EasyOIDC with NiceGUI:\n\n```python\nfrom EasyOIDC import Config, SessionHandler\nfrom EasyOIDC.frameworks.nicegui import NiceGUIOIDClient\nfrom nicegui import app, ui\n\nsession_storage = SessionHandler(mode='shelve')\nauth_config = Config('.env')\nauth = NiceGUIOIDClient(app, auth_config=auth_config, session_storage=session_storage)\n\n@ui.page('/')\ndef root():\n    is_authenticated = auth.is_authenticated()\n    with ui.column().classes('absolute-center '):\n        if is_authenticated:\n            ui.markdown(f\"User authenticated!\")\n            ui.markdown(f\"Name: {auth.get_userinfo()['name']}\")\n            ui.markdown(f\"Email: {auth.get_userinfo()['email']}\")\n            ui.markdown(f\"Roles: {auth.get_user_roles()}\")\n            ui.markdown(f\"\u003ca href='/logout'\u003eLogout\u003c/a\u003e\").classes('text-2xl')\n        else:\n            ui.markdown(f\"NiceGUI demo.\u003cbr\u003e\u003ca href='/login'\u003eLogin\u003c/a\u003e\").classes('text-2xl')\n\n\nif __name__ in {\"__main__\", \"__mp_main__\"}:\n    ui.run(storage_secret=auth_config.cookie_secret_key, port=5000)\n\n```\n\n## Configuration\nYour app routes and server endpoints, can be provided from json and .env files, or via a dict or code of course.\n\nThe following is an example of a .env file:\n\n```bash\n# Auth0 example configuration\n\n# Secret keys\nclient_id = RqtJHUjAyEMXdgT4j2ScdOfjUhFACS9G\nclient_secret = diylwTR8O_Y4B8_4AFXPYRPft3z_Im14hD8suAG8OiLCRtJPuCT6yHqlELQn_Yf\ncookie_secret_key = some-secret-key\n\n# OIDC\nwell_known_openid_url = https://myapplication.us.auth0.com/.well-known/openid-configuration\nredirect_uri = http://localhost:5000/authorize\n\n# Application routes\napp_login_route = /login\napp_logout_route = /logout\napp_authorize_route = /authorize\nunrestricted_routes = /\npost_logout_uri = http://localhost:5000\n```\n\nIn that case, EasyOIDC will get the server endpoints from the well-known url. You can also adapt the file examples/.env.google to your needs.\n\nIf you want to provide the endpoints manually, you can do it as follows:\n\n```bash\n# Google endpoints configuration example: \n\n# OIDC\nwell_known_openid_url = https://accounts.google.com/.well-known/openid-configuration\nauthorization_endpoint = https://accounts.google.com/o/oauth2/auth\ntoken_endpoint = https://oauth2.googleapis.com/token\nuserinfo_endpoint = https://openidconnect.googleapis.com/v1/userinfo\ntoken_revoke_endpoint = https://oauth2.googleapis.com/revoke\nredirect_uri = http://localhost:5000/authorize\nscope = openid,profile,email\n```\n\nAnd more examples via code:\n```python\nfrom EasyOIDC import Config\nconfig = Config(client_id='my_client_id',\n                client_secret='my_client_secret',\n                cookie_secret_key='some-secret-key',\n                redirect_uri='http://localhost:5000/authorize',\n                well_known_openid_url='https://myapplication.us.auth0.com/.well-known/openid-configuration',\n                app_login_route='/login',\n                app_logout_route='/logout',\n                app_authorize_route='/authorize',\n                unrestricted_routes='/',\n                post_logout_uri='http://localhost:5000')\n\n```\n\n### Server session data storage\n\nEasyOIDC needs to store some data in the server session, like tokens and authenticated user information. The library provides a SessionHandler class that can be used to store the session data in memory, in a file or in a Redis database. The SessionHandler class is initialized as follows:\n\n```python\nfrom EasyOIDC import SessionHandler\n\n# Redis memory storage\nsession_storage = SessionHandler(mode='redis')\n\n# or for file storage\nsession_storage = SessionHandler(mode='shelve')\n\n```\n\n**Note:** When using `nicegui` with its auto-reloading feature, it is recommended to use the `redis` mode for the `SessionHandler`. The `shelve` mode is not thread-safe and can cause issues when multiple processes access the same session file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpmanson%2Feasyoidc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpmanson%2Feasyoidc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpmanson%2Feasyoidc/lists"}