mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 09:36:13 +08:00
fix: redirect url change
This commit is contained in:
parent
1a7242abd4
commit
2e4dfbd60f
@ -59,6 +59,7 @@ def start_authorization(
|
|||||||
metadata: Optional[OAuthMetadata],
|
metadata: Optional[OAuthMetadata],
|
||||||
client_information: OAuthClientInformation,
|
client_information: OAuthClientInformation,
|
||||||
redirect_url: str,
|
redirect_url: str,
|
||||||
|
provider_id: str,
|
||||||
) -> tuple[str, str]:
|
) -> tuple[str, str]:
|
||||||
"""Begins the authorization flow."""
|
"""Begins the authorization flow."""
|
||||||
response_type = "code"
|
response_type = "code"
|
||||||
@ -84,7 +85,7 @@ def start_authorization(
|
|||||||
"code_challenge": code_challenge,
|
"code_challenge": code_challenge,
|
||||||
"code_challenge_method": code_challenge_method,
|
"code_challenge_method": code_challenge_method,
|
||||||
"redirect_uri": redirect_url,
|
"redirect_uri": redirect_url,
|
||||||
"state": "/tools?provider_id=" + client_information.client_id,
|
"state": provider_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
authorization_url = f"{authorization_url}?{urllib.parse.urlencode(params)}"
|
authorization_url = f"{authorization_url}?{urllib.parse.urlencode(params)}"
|
||||||
@ -229,6 +230,7 @@ def auth(
|
|||||||
metadata,
|
metadata,
|
||||||
client_information,
|
client_information,
|
||||||
provider.redirect_url,
|
provider.redirect_url,
|
||||||
|
provider.provider_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
provider.save_code_verifier(code_verifier)
|
provider.save_code_verifier(code_verifier)
|
||||||
|
@ -31,7 +31,7 @@ class MCPToolManageService:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def create_mcp_provider(
|
def create_mcp_provider(
|
||||||
tenant_id: str, name: str, server_url: str, user_id: str, icon: str, icon_type: str, icon_background: str
|
tenant_id: str, name: str, server_url: str, user_id: str, icon: str, icon_type: str, icon_background: str
|
||||||
) -> dict:
|
) -> ToolProviderApiEntity:
|
||||||
existing_provider = (
|
existing_provider = (
|
||||||
db.session.query(MCPToolProvider)
|
db.session.query(MCPToolProvider)
|
||||||
.filter(
|
.filter(
|
||||||
@ -58,7 +58,7 @@ class MCPToolManageService:
|
|||||||
)
|
)
|
||||||
db.session.add(mcp_tool)
|
db.session.add(mcp_tool)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return {"result": "success"}
|
return ToolTransformService.mcp_provider_to_user_provider(mcp_tool)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def retrieve_mcp_tools(tenant_id: str) -> list[ToolProviderApiEntity]:
|
def retrieve_mcp_tools(tenant_id: str) -> list[ToolProviderApiEntity]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user