File tree Expand file tree Collapse file tree 5 files changed +11
-4
lines changed Expand file tree Collapse file tree 5 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,7 @@ class Settings(BaseSettings):
228228 OAUTH2_LINUX_DO_CLIENT_SECRET : str
229229
230230 # 基础配置
231+ OAUTH2_BACKEND_BASE_URL : str = 'http://127.0.0.1:8000'
231232 OAUTH2_FRONTEND_REDIRECT_URI : str = 'http://localhost:5173/oauth2/callback'
232233
233234 ##################################################
Original file line number Diff line number Diff line change 1818
1919@router .get ('' , summary = '获取 Github 授权链接' )
2020async def get_github_oauth2_url (request : Request ) -> ResponseSchemaModel [str ]:
21- auth_url = await github_client .get_authorization_url (redirect_uri = f'{ request .url } /callback' )
21+ auth_url = await github_client .get_authorization_url (
22+ redirect_uri = f'{ settings .OAUTH2_BACKEND_BASE_URL } { request .url .path } /callback'
23+ )
2224 return response_base .success (data = auth_url )
2325
2426
Original file line number Diff line number Diff line change 1818
1919@router .get ('' , summary = '获取 google 授权链接' )
2020async def get_google_oauth2_url (request : Request ) -> ResponseSchemaModel [str ]:
21- auth_url = await google_client .get_authorization_url (redirect_uri = f'{ request .url } /callback' )
21+ auth_url = await google_client .get_authorization_url (
22+ redirect_uri = f'{ settings .OAUTH2_BACKEND_BASE_URL } { request .url .path } /callback'
23+ )
2224 return response_base .success (data = auth_url )
2325
2426
Original file line number Diff line number Diff line change 1818
1919@router .get ('' , summary = '获取 LinuxDo 授权链接' )
2020async def get_linux_do_oauth2_url (request : Request ) -> ResponseSchemaModel [str ]:
21- auth_url = await linux_do_client .get_authorization_url (redirect_uri = f'{ request .url } /callback' )
21+ auth_url = await linux_do_client .get_authorization_url (
22+ redirect_uri = f'{ settings .OAUTH2_BACKEND_BASE_URL } { request .url .path } /callback'
23+ )
2224 return response_base .success (data = auth_url )
2325
2426
Original file line number Diff line number Diff line change 11[plugin ]
22summary = ' OAuth 2.0'
3- version = ' 0.0.5 '
3+ version = ' 0.0.6 '
44description = ' 通过 OAuth 2.0 的方式登录系统'
55author = ' wu-clan'
66
You can’t perform that action at this time.
0 commit comments