Skip to content

Fix: add 'api_key' alias for backward compatibility#24022

Merged
crazywoola merged 1 commit intolanggenius:mainfrom
hyongtao-code:fix-24005
Aug 16, 2025
Merged

Fix: add 'api_key' alias for backward compatibility#24022
crazywoola merged 1 commit intolanggenius:mainfrom
hyongtao-code:fix-24005

Conversation

@hyongtao-code
Copy link
Copy Markdown
Contributor

Fixes #24005

In PR #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.

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Screenshots

Before After
... ...

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

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 <yongtaoh@gmail.com>
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 15, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 16, 2025
@crazywoola crazywoola merged commit af10b3c into langgenius:main Aug 16, 2025
7 checks passed
@hyongtao-code hyongtao-code deleted the fix-24005 branch August 16, 2025 11:50
bowenliang123 pushed a commit to bowenliang123/dify that referenced this pull request Aug 18, 2025
Signed-off-by: Yongtao Huang <yongtaoh@gmail.com>
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
qiqizjl pushed a commit to qiqizjl/dify that referenced this pull request Aug 27, 2025
Signed-off-by: Yongtao Huang <yongtaoh@gmail.com>
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
HarryReidx pushed a commit to HarryReidx/dify that referenced this pull request Sep 1, 2025
Signed-off-by: Yongtao Huang <yongtaoh@gmail.com>
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
(cherry picked from commit af10b3c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api test with authorization error : invalid mode value api_key

2 participants