mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 12:37:20 +08:00
fix(trigger): enhance OAuth client response in TriggerOAuthClientManageApi
- Integrated TriggerManager to retrieve the trigger provider's OAuth client schema. - Updated the return structure to include the redirect URI and OAuth client schema for improved API response clarity.
This commit is contained in:
parent
d22404994a
commit
bd5cf1c272
@ -13,6 +13,7 @@ from core.plugin.entities.plugin import TriggerProviderID
|
|||||||
from core.plugin.entities.plugin_daemon import CredentialType
|
from core.plugin.entities.plugin_daemon import CredentialType
|
||||||
from core.plugin.impl.oauth import OAuthHandler
|
from core.plugin.impl.oauth import OAuthHandler
|
||||||
from core.trigger.entities.entities import SubscriptionBuilderUpdater
|
from core.trigger.entities.entities import SubscriptionBuilderUpdater
|
||||||
|
from core.trigger.trigger_manager import TriggerManager
|
||||||
from extensions.ext_database import db
|
from extensions.ext_database import db
|
||||||
from libs.login import current_user, login_required
|
from libs.login import current_user, login_required
|
||||||
from models.account import Account
|
from models.account import Account
|
||||||
@ -445,13 +446,15 @@ class TriggerOAuthClientManageApi(Resource):
|
|||||||
tenant_id=user.current_tenant_id,
|
tenant_id=user.current_tenant_id,
|
||||||
provider_id=provider_id,
|
provider_id=provider_id,
|
||||||
)
|
)
|
||||||
|
provider_controller = TriggerManager.get_trigger_provider(user.current_tenant_id, provider_id)
|
||||||
return {
|
return jsonable_encoder({
|
||||||
"configured": bool(custom_params or system_client),
|
"configured": bool(custom_params or system_client),
|
||||||
|
"oauth_client_schema": provider_controller.get_oauth_client_schema(),
|
||||||
"custom_configured": bool(custom_params),
|
"custom_configured": bool(custom_params),
|
||||||
"custom_enabled": is_custom_enabled,
|
"custom_enabled": is_custom_enabled,
|
||||||
|
"redirect_uri": f"{dify_config.CONSOLE_API_URL}/console/api/oauth/plugin/{provider}/trigger/callback",
|
||||||
"params": custom_params if custom_params else {},
|
"params": custom_params if custom_params else {},
|
||||||
}
|
})
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Error getting OAuth client", exc_info=e)
|
logger.exception("Error getting OAuth client", exc_info=e)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user