# 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/)
[![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": "",
"name": "fastapi-oauth2",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"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/8b/c2/45029483ad897f3ba856e63c1dcf6d6858fb673fc9f80c3f42f9e2e4b695/fastapi-oauth2-1.0.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[![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.0.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": "b3a7057af50cd9fb5fe57f69d0c21517cc1cdfa5da1ffd5cdfb5b903979be645",
"md5": "aeb52d5f589dc39129762251ac40b92c",
"sha256": "e18fb5819f47a07b25e9b0bee253bb412247c12a4a067dc8d655fbd2ba563567"
},
"downloads": -1,
"filename": "fastapi_oauth2-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aeb52d5f589dc39129762251ac40b92c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 9822,
"upload_time": "2024-03-14T13:29:39",
"upload_time_iso_8601": "2024-03-14T13:29:39.967196Z",
"url": "https://files.pythonhosted.org/packages/b3/a7/057af50cd9fb5fe57f69d0c21517cc1cdfa5da1ffd5cdfb5b903979be645/fastapi_oauth2-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8bc245029483ad897f3ba856e63c1dcf6d6858fb673fc9f80c3f42f9e2e4b695",
"md5": "1a89c639fc618210bb88988cf54268f3",
"sha256": "d7bea74843fd096ddaaf93978cf61940efc6e7df719888d1168f2bb56da58910"
},
"downloads": -1,
"filename": "fastapi-oauth2-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "1a89c639fc618210bb88988cf54268f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 10879,
"upload_time": "2024-03-14T13:29:41",
"upload_time_iso_8601": "2024-03-14T13:29:41.578159Z",
"url": "https://files.pythonhosted.org/packages/8b/c2/45029483ad897f3ba856e63c1dcf6d6858fb673fc9f80c3f42f9e2e4b695/fastapi-oauth2-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-14 13:29:41",
"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"
}