Skip to content

Commit

Permalink
Prepare for the release (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-clan authored Feb 7, 2024
1 parent a252f5e commit 4f60b7a
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 7 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# fastapi_oauth20

在 fastapi 中轻松集成 OAuth 2.0 客户端
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fastapi-practices/fastapi_oauth20/ci.yml?logo=github)
[![GitHub](https://img.shields.io/github/license/wu-clan/httpfpt)](https://github.com/wu-clan/httpfpt/blob/master/LICENSE)
![Static Badge](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)
![GitHub release (with filter)](https://img.shields.io/github/v/release/fastapi-practices/fastapi_oauth20)
[![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)

全局异步,支持 python >= 3.10

在 FastAPI 中异步授权 OAuth2 客户端

我们的目标是集成多个 CN 第三方客户端,敬请期待

Expand Down
6 changes: 3 additions & 3 deletions example/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
import uvicorn

from fastapi import Depends, FastAPI
from fastapi_oauth20.clients.google import GoogleOAuth20
from fastapi_oauth20.integrations.fastapi import OAuth20
from starlette.responses import PlainTextResponse

from fastapi_oauth20 import FastAPIOAuth20, GoogleOAuth20

app = FastAPI()

GOOGLE_CLIENT_ID = '1053650337583-ljnla4m1e5cg16erq3tld5vjflqh4bij.apps.googleusercontent.com'
GOOGLE_CLIENT_SECRET = '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'
GOOGLE_REDIRECT_URI = 'http://localhost:8000/auth/google'

google_client = GoogleOAuth20(GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET)
oauth20 = OAuth20(google_client, GOOGLE_REDIRECT_URI)
oauth20 = FastAPIOAuth20(google_client, GOOGLE_REDIRECT_URI)


@app.get('/login/google')
Expand Down
12 changes: 12 additions & 0 deletions fastapi_oauth20/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""在 FastAPI 中异步授权 OAuth2 客户端"""

__version__ = '0.0.1a1'

__all__ = ['OSChinaOAuth20', 'GoogleOAuth20', 'FeiShuOAuth20', 'GiteeOAuth20', 'GitHubOAuth20', 'FastAPIOAuth20']

from .clients.feishu import FeiShuOAuth20
from .clients.gitee import GiteeOAuth20
from .clients.github import GitHubOAuth20
from .clients.google import GoogleOAuth20
from .clients.oschina import OSChinaOAuth20
from .integrations.fastapi import OAuth20 as FastAPIOAuth20
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[project]
name = "fastapi_oauth20"
version = "0.0.1"
description = "FastAPI easily integrates with clients OAuth 2.0"
description = "在 FastAPI 中异步授权 OAuth2 客户端"
dynamic = [
"version",
]
authors = [
{ name = "Wu Clan", email = "jianhengwu0407@gmail.com" },
]
Expand Down Expand Up @@ -38,6 +40,7 @@ quote-style = "single"

[tool.pdm]
package-type = "library"
version = { source = "file", path = "fastapi_oauth20/__init__.py" }

[build-system]
requires = ["pdm-backend"]
Expand Down
Empty file removed src/fastapi_oauth20/__init__.py
Empty file.

0 comments on commit 4f60b7a

Please sign in to comment.