mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-04-22 05:39:42 +08:00
fix(typing): validate OAuth code before processing access token (#18288)
This commit is contained in:
parent
defd5520ea
commit
8f547e6340
@ -74,7 +74,9 @@ class OAuthDataSourceBinding(Resource):
|
|||||||
if not oauth_provider:
|
if not oauth_provider:
|
||||||
return {"error": "Invalid provider"}, 400
|
return {"error": "Invalid provider"}, 400
|
||||||
if "code" in request.args:
|
if "code" in request.args:
|
||||||
code = request.args.get("code")
|
code = request.args.get("code", "")
|
||||||
|
if not code:
|
||||||
|
return {"error": "Invalid code"}, 400
|
||||||
try:
|
try:
|
||||||
oauth_provider.get_access_token(code)
|
oauth_provider.get_access_token(code)
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user