mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
fix(lint): ruff
This commit is contained in:
@@ -4513,24 +4513,24 @@ class MCPOAuthCallback(Resource):
|
|||||||
)
|
)
|
||||||
if not code or not state:
|
if not code or not state:
|
||||||
return redirect(
|
return redirect(
|
||||||
f"/api/connectors/callback-status?status=error&message=Authorization+code+or+state+not+provided.+Please+complete+the+authorization+process+and+make+sure+to+grant+offline+access.&provider=mcp_tool"
|
"/api/connectors/callback-status?status=error&message=Authorization+code+or+state+not+provided.+Please+complete+the+authorization+process+and+make+sure+to+grant+offline+access.&provider=mcp_tool"
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
redis_client = get_redis_instance()
|
redis_client = get_redis_instance()
|
||||||
if not redis_client:
|
if not redis_client:
|
||||||
return redirect(
|
return redirect(
|
||||||
f"/api/connectors/callback-status?status=error&message=Internal+server+error:+Redis+not+available.&provider=mcp_tool"
|
"/api/connectors/callback-status?status=error&message=Internal+server+error:+Redis+not+available.&provider=mcp_tool"
|
||||||
)
|
)
|
||||||
code = unquote(code)
|
code = unquote(code)
|
||||||
manager = MCPOAuthManager(redis_client)
|
manager = MCPOAuthManager(redis_client)
|
||||||
success = manager.handle_oauth_callback(state, code, error)
|
success = manager.handle_oauth_callback(state, code, error)
|
||||||
if success:
|
if success:
|
||||||
return redirect(
|
return redirect(
|
||||||
f"/api/connectors/callback-status?status=success&message=Authorization+code+received+successfully.+You+can+close+this+window.&provider=mcp_tool"
|
"/api/connectors/callback-status?status=success&message=Authorization+code+received+successfully.+You+can+close+this+window.&provider=mcp_tool"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return redirect(
|
return redirect(
|
||||||
f"/api/connectors/callback-status?status=error&message=OAuth+callback+failed.&provider=mcp_tool"
|
"/api/connectors/callback-status?status=error&message=OAuth+callback+failed.&provider=mcp_tool"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.error(
|
current_app.logger.error(
|
||||||
|
|||||||
Reference in New Issue
Block a user