feat(oauth): clean up imports and streamline OAuth client parameter retrieval

This commit is contained in:
Harry 2025-07-11 13:51:31 +08:00
parent f3bbab0eed
commit 545c21b196
2 changed files with 3 additions and 7 deletions

View File

@ -1,7 +1,6 @@
import io
from urllib.parse import urlparse
from flask import redirect, send_file
from flask import make_response, redirect, request, send_file
from flask_login import current_user
from flask_restful import (
@ -18,7 +17,6 @@ from controllers.console.wraps import (
enterprise_license_required,
setup_required,
)
from controllers.console.wraps import account_initialization_required, enterprise_license_required, setup_required
from core.mcp.auth.auth_flow import auth, handle_callback
from core.mcp.auth.auth_provider import OAuthClientProvider
from core.mcp.error import MCPAuthError, MCPError
@ -695,10 +693,7 @@ class ToolPluginOAuthApi(Resource):
raise Forbidden()
tenant_id = user.current_tenant_id
oauth_client_params = BuiltinToolManageService.get_oauth_client(
tenant_id=tenant_id,
provider=provider
)
oauth_client_params = BuiltinToolManageService.get_oauth_client(tenant_id=tenant_id, provider=provider)
if oauth_client_params is None:
raise Forbidden("no oauth available client config found for this tool provider")
@ -851,6 +846,7 @@ api.add_resource(ToolOAuthCallback, "/oauth/plugin/<path:provider>/tool/callback
api.add_resource(ToolOAuthCustomClient, "/workspaces/current/tool-provider/builtin/<path:provider>/oauth/custom-client")
class ToolProviderMCPApi(Resource):
@setup_required
@login_required

View File

@ -46,7 +46,7 @@ from core.tools.entities.tool_entities import (
ToolParameter,
ToolProviderType,
)
from core.tools.errors import ToolNotFoundError, ToolProviderNotFoundError
from core.tools.errors import ToolProviderNotFoundError
from core.tools.tool_label_manager import ToolLabelManager
from core.tools.utils.configuration import (
ToolParameterConfigurationManager,