# fastapi-oauth2 <img src="https://github.com/pysnippet.png" align="right" height="64" />
[![PyPI](https://img.shields.io/pypi/v/fastapi-oauth2.svg)](https://pypi.org/project/fastapi-oauth2/)
[![Playground](https://img.shields.io/badge/playground-blue.svg?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNzEzNTE0OTc5MTUzIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjE2MjciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PHBhdGggZD0iTTc2OCA1MDYuMDI2NjY3djExLjk0NjY2NmEzMi40MjY2NjcgMzIuNDI2NjY3IDAgMCAxLTE1Ljc4NjY2NyAyNy43MzMzMzRMMzcwLjM0NjY2NyA3NjhjLTIzLjA0IDEzLjY1MzMzMy0zNC45ODY2NjcgMTMuNjUzMzMzLTQ1LjIyNjY2NyA3LjY4bC0xMC42NjY2NjctNS45NzMzMzNhMzIuNDI2NjY3IDMyLjQyNjY2NyAwIDAgMS0xNS43ODY2NjYtMjYuODhWMjgxLjE3MzMzM2EzMi40MjY2NjcgMzIuNDI2NjY3IDAgMCAxIDE1Ljc4NjY2Ni0yNy43MzMzMzNsMTAuNjY2NjY3LTUuOTczMzMzYzEwLjI0LTUuOTczMzMzIDIyLjE4NjY2Ny01Ljk3MzMzMyA1Mi4wNTMzMzMgMTEuNTJsMzc1LjA0IDIxOS4zMDY2NjZhMzIuNDI2NjY3IDMyLjQyNjY2NyAwIDAgMSAxNS43ODY2NjcgMjcuNzMzMzM0eiIgcC1pZD0iMTYyOCIgZGF0YS1zcG0tYW5jaG9yLWlkPSJhMzEzeC5zZWFyY2hfaW5kZXguMC5pMS40NzE5M2E4MVdiYjYyWiIgY2xhc3M9IiIgZmlsbD0iI2ZmZmZmZiI+PC9wYXRoPjwvc3ZnPg==)](https://playground.pysnippet.org/fastapi-oauth2/)
[![Python](https://img.shields.io/pypi/pyversions/fastapi-oauth2.svg?logoColor=white)](https://pypi.org/project/fastapi-oauth2/)
[![FastAPI](https://img.shields.io/badge/fastapi-%E2%89%A50.68.1-009486)](https://pypi.org/project/fastapi-oauth2/)
[![Tests](https://github.com/pysnippet/fastapi-oauth2/actions/workflows/tests.yml/badge.svg)](https://github.com/pysnippet/fastapi-oauth2/actions/workflows/tests.yml)
[![Docs](https://github.com/pysnippet/fastapi-oauth2/actions/workflows/docs.yml/badge.svg)](https://github.com/pysnippet/fastapi-oauth2/actions/workflows/docs.yml)
FastAPI OAuth2 is a middleware-based social authentication mechanism supporting several OAuth2 providers. It leverages
the [social-core](https://github.com/python-social-auth/social-core) authentication backends and integrates seamlessly
with FastAPI applications.
## Integration
For integrating the package into an existing FastAPI application, the router with OAuth2 routes and
the `OAuth2Middleware` with particular [configs](https://docs.pysnippet.org/fastapi-oauth2/integration/configuration)
should be added to the application.
```python
from fastapi import FastAPI
from fastapi_oauth2.middleware import OAuth2Middleware
from fastapi_oauth2.router import router as oauth2_router
app = FastAPI()
app.include_router(oauth2_router)
app.add_middleware(OAuth2Middleware, config=OAuth2Config(...))
```
## Contribute
Any contribution is welcome. Always feel free to open an issue or a discussion if you have any questions not covered by
the documentation. If you have any ideas or suggestions, please, open a pull request. Your name will shine in our
contributors' list. Be proud of what you build!
## License
Copyright (C) 2023 Artyom Vancyan. [MIT](https://github.com/pysnippet/fastapi-oauth2/blob/master/LICENSE)
Raw data
{
"_id": null,
"home_page": null,
"name": "fastapi-oauth2",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "python, sso, auth, login, oauth, oauth2, social, fastapi, allauth, security, middleware, authentication",
"author": "Artyom Vancyan",
"author_email": "artyom@pysnippet.org",
"download_url": "https://files.pythonhosted.org/packages/6b/0c/bc1b22b2f9b8d485d2ca843d7ea53b5cfc86cf9887ed4339445a192c0e8c/fastapi_oauth2-1.3.0.tar.gz",
"platform": "unix",
"description": "# fastapi-oauth2 <img src=\"https://github.com/pysnippet.png\" align=\"right\" height=\"64\" />\n\n[![PyPI](https://img.shields.io/pypi/v/fastapi-oauth2.svg)](https://pypi.org/project/fastapi-oauth2/)\n[![Playground](https://img.shields.io/badge/playground-blue.svg?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNzEzNTE0OTc5MTUzIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjE2MjciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PHBhdGggZD0iTTc2OCA1MDYuMDI2NjY3djExLjk0NjY2NmEzMi40MjY2NjcgMzIuNDI2NjY3IDAgMCAxLTE1Ljc4NjY2NyAyNy43MzMzMzRMMzcwLjM0NjY2NyA3NjhjLTIzLjA0IDEzLjY1MzMzMy0zNC45ODY2NjcgMTMuNjUzMzMzLTQ1LjIyNjY2NyA3LjY4bC0xMC42NjY2NjctNS45NzMzMzNhMzIuNDI2NjY3IDMyLjQyNjY2NyAwIDAgMS0xNS43ODY2NjYtMjYuODhWMjgxLjE3MzMzM2EzMi40MjY2NjcgMzIuNDI2NjY3IDAgMCAxIDE1Ljc4NjY2Ni0yNy43MzMzMzNsMTAuNjY2NjY3LTUuOTczMzMzYzEwLjI0LTUuOTczMzMzIDIyLjE4NjY2Ny01Ljk3MzMzMyA1Mi4wNTMzMzMgMTEuNTJsMzc1LjA0IDIxOS4zMDY2NjZhMzIuNDI2NjY3IDMyLjQyNjY2NyAwIDAgMSAxNS43ODY2NjcgMjcuNzMzMzM0eiIgcC1pZD0iMTYyOCIgZGF0YS1zcG0tYW5jaG9yLWlkPSJhMzEzeC5zZWFyY2hfaW5kZXguMC5pMS40NzE5M2E4MVdiYjYyWiIgY2xhc3M9IiIgZmlsbD0iI2ZmZmZmZiI+PC9wYXRoPjwvc3ZnPg==)](https://playground.pysnippet.org/fastapi-oauth2/)\n[![Python](https://img.shields.io/pypi/pyversions/fastapi-oauth2.svg?logoColor=white)](https://pypi.org/project/fastapi-oauth2/)\n[![FastAPI](https://img.shields.io/badge/fastapi-%E2%89%A50.68.1-009486)](https://pypi.org/project/fastapi-oauth2/)\n[![Tests](https://github.com/pysnippet/fastapi-oauth2/actions/workflows/tests.yml/badge.svg)](https://github.com/pysnippet/fastapi-oauth2/actions/workflows/tests.yml)\n[![Docs](https://github.com/pysnippet/fastapi-oauth2/actions/workflows/docs.yml/badge.svg)](https://github.com/pysnippet/fastapi-oauth2/actions/workflows/docs.yml)\n\nFastAPI OAuth2 is a middleware-based social authentication mechanism supporting several OAuth2 providers. It leverages\nthe [social-core](https://github.com/python-social-auth/social-core) authentication backends and integrates seamlessly\nwith FastAPI applications.\n\n## Integration\n\nFor integrating the package into an existing FastAPI application, the router with OAuth2 routes and\nthe `OAuth2Middleware` with particular [configs](https://docs.pysnippet.org/fastapi-oauth2/integration/configuration)\nshould be added to the application.\n\n```python\nfrom fastapi import FastAPI\nfrom fastapi_oauth2.middleware import OAuth2Middleware\nfrom fastapi_oauth2.router import router as oauth2_router\n\napp = FastAPI()\napp.include_router(oauth2_router)\napp.add_middleware(OAuth2Middleware, config=OAuth2Config(...))\n```\n\n## Contribute\n\nAny contribution is welcome. Always feel free to open an issue or a discussion if you have any questions not covered by\nthe documentation. If you have any ideas or suggestions, please, open a pull request. Your name will shine in our\ncontributors' list. Be proud of what you build!\n\n## License\n\nCopyright (C) 2023 Artyom Vancyan. [MIT](https://github.com/pysnippet/fastapi-oauth2/blob/master/LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Easy to integrate OAuth2 authentication with support for several identity providers.",
"version": "1.3.0",
"project_urls": {
"Documentation": "https://docs.pysnippet.org/fastapi-oauth2/",
"Source Code": "https://github.com/pysnippet/fastapi-oauth2/"
},
"split_keywords": [
"python",
" sso",
" auth",
" login",
" oauth",
" oauth2",
" social",
" fastapi",
" allauth",
" security",
" middleware",
" authentication"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d75d0ffec625ac4cb4813af29993d9e187a2238990d6053f66e91beed4dfdefc",
"md5": "3fec54de0bf33f5ac18591d7e14a30c6",
"sha256": "4acdc81ba6e656a340a9b7f8f4e8dccd3974b3df30596d760eb88c1cf721272e"
},
"downloads": -1,
"filename": "fastapi_oauth2-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3fec54de0bf33f5ac18591d7e14a30c6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 10770,
"upload_time": "2024-09-30T18:26:43",
"upload_time_iso_8601": "2024-09-30T18:26:43.468240Z",
"url": "https://files.pythonhosted.org/packages/d7/5d/0ffec625ac4cb4813af29993d9e187a2238990d6053f66e91beed4dfdefc/fastapi_oauth2-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6b0cbc1b22b2f9b8d485d2ca843d7ea53b5cfc86cf9887ed4339445a192c0e8c",
"md5": "dd206dedb0ff65cece04dcdaa63c5edc",
"sha256": "8c8135b571af9f882cc94a23afd271107e7a963a966213113a0c0ce0a22ba91c"
},
"downloads": -1,
"filename": "fastapi_oauth2-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "dd206dedb0ff65cece04dcdaa63c5edc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 13235,
"upload_time": "2024-09-30T18:26:44",
"upload_time_iso_8601": "2024-09-30T18:26:44.791013Z",
"url": "https://files.pythonhosted.org/packages/6b/0c/bc1b22b2f9b8d485d2ca843d7ea53b5cfc86cf9887ed4339445a192c0e8c/fastapi_oauth2-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-30 18:26:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pysnippet",
"github_project": "fastapi-oauth2",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "fastapi-oauth2"
}