File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 66from social_core .backends .github import GithubOAuth2
77
88from demo .router import router as demo_router
9+ from fastapi_oauth2 .client import OAuth2Client
910from fastapi_oauth2 .middleware import OAuth2Middleware
1011from fastapi_oauth2 .router import router as oauth2_router
11- from fastapi_oauth2 .types import OAuth2Client
1212
1313router = APIRouter ()
1414templates = Jinja2Templates (directory = "templates" )
@@ -31,6 +31,7 @@ async def root(request: Request):
3131 client_id = "eccd08d6736b7999a32a" ,
3232 client_secret = "642999c1c5f2b3df8b877afdc78252ef5b594d31" ,
3333 redirect_uri = "http://127.0.0.1:8000/" ,
34+ scope = ["user:email" ],
3435 ),
3536 ]
3637})
Original file line number Diff line number Diff line change 1+ from typing import Optional , Type , Sequence
2+
3+ from social_core .backends .oauth import BaseOAuth2
4+
5+
6+ class OAuth2Client :
7+ backend : Type [BaseOAuth2 ]
8+ client_id : str
9+ client_secret : str
10+ redirect_uri : Optional [str ]
11+ scope : Optional [Sequence [str ]]
12+
13+ def __init__ (
14+ self ,
15+ * ,
16+ backend : Type [BaseOAuth2 ],
17+ client_id : str ,
18+ client_secret : str ,
19+ redirect_uri : Optional [str ] = None ,
20+ scope : Optional [Sequence [str ]] = None ,
21+ ):
22+ self .backend = backend
23+ self .client_id = client_id
24+ self .client_secret = client_secret
25+ self .redirect_uri = redirect_uri
26+ self .scope = scope or []
You can’t perform that action at this time.
0 commit comments