{"id":13424564,"url":"https://github.com/yezz123/AuthX","last_synced_at":"2025-03-15T18:35:20.583Z","repository":{"id":36983996,"uuid":"399171157","full_name":"yezz123/authx","owner":"yezz123","description":"Ready-to-use and customizable Authentications and Oauth2 management for FastAPI ✨","archived":false,"fork":false,"pushed_at":"2024-10-29T13:44:04.000Z","size":2964,"stargazers_count":809,"open_issues_count":5,"forks_count":49,"subscribers_count":16,"default_branch":"main","last_synced_at":"2024-10-29T15:19:37.862Z","etag":null,"topics":["authentification","authorization","backend","fastapi","jwt","pydantic","python","starlette"],"latest_commit_sha":null,"homepage":"https://authx.yezz.me/","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/yezz123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"yezz123","polar":"yezz123"}},"created_at":"2021-08-23T16:18:04.000Z","updated_at":"2024-10-29T13:44:08.000Z","dependencies_parsed_at":"2024-04-30T00:30:29.551Z","dependency_job_id":"e175645b-04ce-40e5-bf66-1d03832b494d","html_url":"https://github.com/yezz123/authx","commit_stats":{"total_commits":1150,"total_committers":18,"mean_commits":"63.888888888888886","dds":"0.36173913043478256","last_synced_commit":"37b00b912de28dc880300f62c95391ce70d3a33d"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yezz123%2Fauthx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yezz123%2Fauthx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yezz123%2Fauthx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yezz123%2Fauthx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yezz123","download_url":"https://codeload.github.com/yezz123/authx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243775875,"owners_count":20346281,"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":["authentification","authorization","backend","fastapi","jwt","pydantic","python","starlette"],"created_at":"2024-07-31T00:00:56.270Z","updated_at":"2025-03-15T18:35:20.556Z","avatar_url":"https://github.com/yezz123.png","language":"Python","funding_links":["https://github.com/sponsors/yezz123","https://polar.sh/yezz123"],"categories":["Third-Party Extensions"],"sub_categories":["Auth"],"readme":"# Authx\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://authx.yezz.me\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/52716203/136962014-280d82b0-0640-4ee5-9a11-b451b338f6d8.png\" alt=\"AuthX\"\u003e\n\u003c/a\u003e\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eReady-to-use and customizable Authentications and Oauth2 management for FastAPI ⚡\u003c/em\u003e\n\u003c/p\u003e\n\u003c/p\u003e\n\n---\n\n| Project | Status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |\n|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| CI      | [ ![ CI ]( https://github.com/yezz123/authx/actions/workflows/ci.yml/badge.svg ) ]( https://github.com/yezz123/authx/actions/workflows/ci.yml )  [ ![ pre-commit.ci status ]( https://results.pre-commit.ci/badge/github/yezz123/authx/main.svg )   ]( https://results.pre-commit.ci/latest/github/yezz123/authx/main )  [ ![ Codecov ]( https://codecov.io/gh/yezz123/authx/branch/main/graph/badge.svg )   ]( https://codecov.io/gh/yezz123/authx ) |\n| Meta    | [ ![ Package version ]( https://img.shields.io/pypi/v/authx?color=%2334D058\u0026label=pypi%20package )   ]( https://pypi.org/project/authx )  [ ![ Downloads ]( https://static.pepy.tech/badge/authx )   ]( https://pepy.tech/project/authx )  [ ![ Pydantic Version 2 ]( https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json )   ]( https://pydantic.dev )  [ ![ Ruff ]( https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json ) ]( https://github.com/astral-sh/ruff ) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=yezz123_authx\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=yezz123_authx)                                                                                                                                                 |\n\n---\n\n**Source Code**: \u003chttps://github.com/yezz123/authx\u003e\n\n**Documentation**: \u003chttps://authx.yezz.me/\u003e\n\n---\n\nAdd a Fully registration and authentication or authorization system to your\n[FastAPI](https://fastapi.tiangolo.com/) project. **AuthX** is designed to be as\ncustomizable and adaptable as possible.\n\n## Features\n\n- [x] Support Python 3.8+ \u0026 Pydantic 1.7+.\n- [x] Multiple customizable authentication backend:\n  - [x] JWT authentication backend included\n    - [x] JWT encoding/decoding for application authentication\n    - [x] Automatic detection of JWTs in requests:\n      - [x] JWTs in headers\n      - [x] JWTs in cookies\n      - [x] JWTs in query parameters\n      - [x] JWTs in request bodies\n  - [x] Cookie authentication backend included\n- [x] Middleware for authentication and authorization through JWT.\n- [x] Extensible Error Handling System.\n\n### Extra Features\n\nAuthX is designed to be as customizable and adaptable as possible.\n\nSo you need to install [`authx-extra`](https://github.com/yezz123/authx-extra) to get extra features.\n\n- [x] Using Redis as a session store \u0026 cache.\n- [x] Support HTTPCache.\n- [x] Support Sessions and Pre-built CRUD functions and Instance to launch Redis.\n- [x] Support Middleware of [pyinstrument](https://pyinstrument.readthedocs.io/) to check your service performance.\n- [x] Support Middleware for collecting and exposing [Prometheus](https://prometheus.io/) metrics.\n\n**Note:** Check [Release Notes](https://authx.yezz.me/release/).\n\n## Project using\n\nHere is a simple way to kickstart your project with AuthX:\n\n```python\nfrom fastapi import FastAPI, Depends, HTTPException\nfrom authx import AuthX, AuthXConfig, RequestToken\n\napp = FastAPI()\n\nconfig = AuthXConfig(\n     JWT_ALGORITHM = \"HS256\",\n     JWT_SECRET_KEY = \"SECRET_KEY\",\n     JWT_TOKEN_LOCATION = [\"headers\"],\n)\n\nauth = AuthX(config=config)\nauth.handle_errors(app)\n\n@app.get('/login')\ndef login(username: str, password: str):\n     if username == \"xyz\" and password == \"xyz\":\n          token = auth.create_access_token(uid=username)\n          return {\"access_token\": token}\n     raise HTTPException(401, detail={\"message\": \"Invalid credentials\"})\n\n@app.get(\"/protected\", dependencies=[Depends(auth.get_token_from_request)])\ndef get_protected(token: RequestToken = Depends()):\n     try:\n          auth.verify_token(token=token)\n          return {\"message\": \"Hello world !\"}\n     except Exception as e:\n          raise HTTPException(401, detail={\"message\": str(e)}) from e\n```\n\n## Contributors and sponsors\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThanks goes to these wonderful people\n([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://yezz.me\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/52716203?v=4?s=100\" width=\"100px;\" alt=\"Yasser Tahiri\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eYasser Tahiri\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/commits?author=yezz123\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/yezz123/authx/commits?author=yezz123\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#maintenance-yezz123\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"#infra-yezz123\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://soubai.me\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/11523791?v=4?s=100\" width=\"100px;\" alt=\"Abderrahim SOUBAI-ELIDRISI\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAbderrahim SOUBAI-ELIDRISI\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/pulls?q=is%3Apr+reviewed-by%3AAbderrahimSoubaiElidrissi\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e \u003ca href=\"https://github.com/yezz123/authx/commits?author=AbderrahimSoubaiElidrissi\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://smakosh.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/20082141?v=4?s=100\" width=\"100px;\" alt=\"Ismail Ghallou \"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eIsmail Ghallou \u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/commits?author=smakosh\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#security-smakosh\" title=\"Security\"\u003e🛡️\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/MojixCoder\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/76670309?v=4?s=100\" width=\"100px;\" alt=\"MojixCoder\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMojixCoder\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/commits?author=MojixCoder\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/yezz123/authx/issues?q=author%3AMojixCoder\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://sralab.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1815?v=4?s=100\" width=\"100px;\" alt=\"Stéphane Raimbault\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eStéphane Raimbault\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/commits?author=stephane\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#plugin-stephane\" title=\"Plugin/utility libraries\"\u003e🔌\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/theoohoho\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/31537466?v=4?s=100\" width=\"100px;\" alt=\"theoohoho\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003etheoohoho\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/commits?author=theoohoho\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://yogeshupadhyay.netlify.app/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/53992168?v=4?s=100\" width=\"100px;\" alt=\"Yogesh Upadhyay\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eYogesh Upadhyay\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/issues?q=author%3AYogeshUpdhyay\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/iftenet\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1397880?v=4?s=100\" width=\"100px;\" alt=\"Roman\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRoman\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/issues?q=author%3Aiftenet\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://www.linkedin.com/today/author/alobbs\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/170559?v=4?s=100\" width=\"100px;\" alt=\"Alvaro Lopez Ortega\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlvaro Lopez Ortega\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/commits?author=alobbs\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/pinchXOXO\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/68501799?v=4?s=100\" width=\"100px;\" alt=\"Devy Santo\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDevy Santo\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#infra-pinchXOXO\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/pg365\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/173273017?v=4?s=100\" width=\"100px;\" alt=\"pg365\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003epg365\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#infra-pg365\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/jor-rit\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/16398756?v=4?s=100\" width=\"100px;\" alt=\"Jorrit\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJorrit\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#platform-jor-rit\" title=\"Packaging/porting to new platform\"\u003e📦\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/callamd\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1664656?v=4?s=100\" width=\"100px;\" alt=\"Callam\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eCallam\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/yezz123/authx/commits?author=callamd\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the\n[all-contributors](https://github.com/all-contributors/all-contributors)\nspecification. Contributions of any kind welcome!\n\n## License\n\nThis project is licensed under the terms of the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyezz123%2FAuthX","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyezz123%2FAuthX","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyezz123%2FAuthX/lists"}