File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 11OAUTH2_CLIENT_ID = eccd08d6736b7999a32a
22OAUTH2_CLIENT_SECRET = 642999c1c5f2b3df8b877afdc78252ef5b594d31
3- OAUTH2_CALLBACK_URL = http://127.0.0.1:8000/auth/callback
3+ OAUTH2_CALLBACK_URL = http://127.0.0.1:8000/oauth2/token
44OAUTH2_REDIRECT_URL = http://127.0.0.1:8000/
55
66JWT_SECRET = secret
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ async def get_token_data(
9898 params : Optional [Dict [str , Any ]] = None ,
9999 headers : Optional [Dict [str , Any ]] = None ,
100100 redirect_uri : Optional [str ] = None ,
101- ) -> Optional [dict ]:
101+ ) -> Optional [Dict [ str , Any ] ]:
102102 params = params or {}
103103 additional_headers = headers or {}
104104 additional_headers .update (self .additional_headers or {})
Original file line number Diff line number Diff line change 1010 OAUTH2_REDIRECT_URL ,
1111)
1212
13- router = APIRouter ()
13+ router = APIRouter (prefix = "/oauth2" )
1414oauth2 = GitHubOAuth2 (
1515 client_id = OAUTH2_CLIENT_ID ,
1616 client_secret = OAUTH2_CLIENT_SECRET ,
1919)
2020
2121
22- @router .get ("/auth/ login" )
22+ @router .get ("/login" )
2323async def login ():
2424 return await oauth2 .login_redirect ()
2525
2626
27- @router .get ("/auth/callback " )
28- async def callback (request : Request ):
27+ @router .get ("/token " )
28+ async def token (request : Request ):
2929 return await oauth2 .token_redirect (request )
3030
3131
32- @router .get ("/auth/ logout" )
32+ @router .get ("/logout" )
3333async def logout ():
3434 response = RedirectResponse (OAUTH2_REDIRECT_URL )
3535 response .delete_cookie ("Authorization" )
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments