Skip to content

Conversation

@ACAne0320
Copy link
Contributor

@ACAne0320 ACAne0320 commented Jun 28, 2025

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

Before After
image image
image

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Copilot AI review requested due to automatic review settings June 28, 2025 05:20
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🔨 feat:tools Tools for agent, function call related stuff. labels Jun 28, 2025
Copy link
Contributor

Copilot AI left a 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.

@ACAne0320
Copy link
Contributor Author

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.
Thanks!

Copy link
Member

@crazywoola crazywoola left a 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.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 11, 2025
@crazywoola crazywoola merged commit e576b98 into langgenius:main Jul 11, 2025
7 checks passed
yijiaquan pushed a commit to yijiaquan/dify that referenced this pull request Jul 14, 2025
hyongtao-code added a commit to hyongtao-code/dify that referenced this pull request Aug 15, 2025
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]>
hyongtao-code added a commit to hyongtao-code/dify that referenced this pull request Aug 15, 2025
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 feat:tools Tools for agent, function call related stuff. lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support API Key Authentication via Query Parameter (not Header)

2 participants