-
Notifications
You must be signed in to change notification settings - Fork 18.9k
feat(tool): add support for API key authentication via query parameter #21656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements support for API key authentication via a query parameter, enabling third-party APIs that leverage query-based authentication to work with Dify’s custom API tools.
- Updated UI translations in both Chinese and English to reflect new authentication types.
- Modified TypeScript types and authentication logic throughout the frontend and backend to support "api_key_query" alongside the existing header-based option.
- Extended credential configuration in API tool provider setups and HTTP request assembly to account for query parameter authentication.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| web/i18n/zh-Hans/tools.ts | Added translation keys and tooltips for query parameter authentication. |
| web/i18n/en-US/tools.ts | Added translation keys and tooltips for query parameter authentication. |
| web/app/components/tools/types.ts | Updated enum values to use consistent naming for header vs. query authentication. |
| web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx | Updated UI for selecting authentication types and setting appropriate credential fields. |
| api/services/tools/tools_transform_service.py | Updated provider-to-controller transformation to support new auth types with backward compatibility. |
| api/core/tools/tool_manager.py | Updated logic for determining authentication type from provider credentials. |
| api/core/tools/entities/tool_entities.py | Updated enum for API provider authentication types. |
| api/core/tools/custom_tool/tool.py | Added support for query parameter authentication in request assembly. |
| api/core/tools/custom_tool/provider.py | Updated provider configuration to include schema for query parameter authentication. |
web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx
Show resolved
Hide resolved
|
Hi @crazywoola , just wanted to gently check in on this PR. No rush, but I was wondering if you might have a chance to take a look when you have a moment. Please let me know if there are any changes I can make to help move this forward. |
crazywoola
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry for the late review.
langgenius#21656) (cherry picked from commit e576b98)
In PR langgenius#21656, the 'api_key' auth mode was deprecated in favor of 'api_key_header' and 'api_key_query'. This change adds a tiny alias in `ApiProviderAuthType.value_of` to map legacy 'api_key' to 'api_key_header', preventing breaking existing configurations that still use the old value. Signed-off-by: Yongtao Huang <[email protected]>
In PR langgenius#21656, the 'api_key' auth mode was deprecated in favor of 'api_key_header' and 'api_key_query'. This change adds a tiny alias in `ApiProviderAuthType.value_of` to map legacy 'api_key' to 'api_key_header', preventing breaking existing configurations that still use the old value. Signed-off-by: Yongtao Huang <[email protected]>
Summary
close #21102
This PR adds support for query parameter authentication in Dify's custom API tools, expanding compatibility with third-party APIs that use query-based authentication.
Screenshots
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods