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 6
6
from social_core .backends .github import GithubOAuth2
7
7
8
8
from demo .router import router as demo_router
9
+ from fastapi_oauth2 .client import OAuth2Client
9
10
from fastapi_oauth2 .middleware import OAuth2Middleware
10
11
from fastapi_oauth2 .router import router as oauth2_router
11
- from fastapi_oauth2 .types import OAuth2Client
12
12
13
13
router = APIRouter ()
14
14
templates = Jinja2Templates (directory = "templates" )
@@ -31,6 +31,7 @@ async def root(request: Request):
31
31
client_id = "eccd08d6736b7999a32a" ,
32
32
client_secret = "642999c1c5f2b3df8b877afdc78252ef5b594d31" ,
33
33
redirect_uri = "http://127.0.0.1:8000/" ,
34
+ scope = ["user:email" ],
34
35
),
35
36
]
36
37
})
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