The API secret key Copy button invalid #22165

Open
opened 2026-02-21 20:16:01 -05:00 by yindo · 6 comments
Owner

Originally created by @Gnywin on GitHub (Feb 9, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.12.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image The api secret key, copy button no use.

✔️ Expected Behavior

When I update the version to 1.12.1 .always encounter this bug .I can‘t copy anyone api secret key .

Actual Behavior

The api secret key, copy button no use. And no response console ,no any requests happened.

Originally created by @Gnywin on GitHub (Feb 9, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.12.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="921" height="325" alt="Image" src="https://github.com/user-attachments/assets/27305554-3e64-4a55-89e0-2c1d8808a80d" /> The api secret key, copy button no use. ### ✔️ Expected Behavior When I update the version to 1.12.1 .always encounter this bug .I can‘t copy anyone api secret key . ### ❌ Actual Behavior The api secret key, copy button no use. And no response console ,no any requests happened.
yindo added the 🐞 bugstatus: accepting prs labels 2026-02-21 20:16:01 -05:00
Author
Owner

@crazywoola commented on GitHub (Feb 10, 2026):

Can not reproduce this.

Image
@crazywoola commented on GitHub (Feb 10, 2026): Can not reproduce this. <img width="1070" height="646" alt="Image" src="https://github.com/user-attachments/assets/9399c787-bd69-4d03-bbf3-026b9d6217c0" />
Author
Owner

@Gnywin commented on GitHub (Feb 10, 2026):

Can not reproduce this.

Image

Maybe the error was caused by my updating the code using file overwrite,could you please tell me the path corresponding to the frontend code, so that I can delete the existing code and use the complete new version of the code to avoid errors caused by overwriting?

@Gnywin commented on GitHub (Feb 10, 2026): > Can not reproduce this. > > <img alt="Image" width="1070" height="646" src="https://private-user-images.githubusercontent.com/100913391/547574215-9399c787-bd69-4d03-bbf3-026b9d6217c0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzA3MTI5NTIsIm5iZiI6MTc3MDcxMjY1MiwicGF0aCI6Ii8xMDA5MTMzOTEvNTQ3NTc0MjE1LTkzOTljNzg3LWJkNjktNGQwMy1iYmYzLTAyNmI5ZDYyMTdjMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDIxMFQwODM3MzJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hMzMwYzBmYTQzNTQwMTRiOTEyOTcyNTU3M2JhMTE0MTYxMWYxZTc1MjFiM2RlNzY5ODY2YjdiYTFmNDU3ODdkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.YcJr22QaiL7IaBRGQ4SK_79k0oaWmmVu5DpO0weHShQ"> Maybe the error was caused by my updating the code using file overwrite,could you please tell me the path corresponding to the frontend code, so that I can delete the existing code and use the complete new version of the code to avoid errors caused by overwriting?
Author
Owner

@crazywoola commented on GitHub (Feb 10, 2026):

@dosu Find the related code of the 'copy' function

@crazywoola commented on GitHub (Feb 10, 2026): @dosu Find the related code of the 'copy' function
Author
Owner

@dosubot[bot] commented on GitHub (Feb 10, 2026):

The copy functionality for API secret keys is implemented in web/app/components/develop/secret-key/input-copy.tsx:

import copy from 'copy-to-clipboard'

// Lines 41-44: The copy action
onClick={() => {
  copy(value)
  setIsCopied(true)
}}

The component uses the copy-to-clipboard npm library. There are two ways to copy:

  1. Clicking the text (lines 39-52) - triggers copy(value) directly
  2. CopyFeedback button (line 55) - uses <CopyFeedback content={value} />

This component is used in secret-key-generate.tsx to display the generated API token.

The issue you're experiencing is likely due to the clipboard API requiring HTTPS. The copy-to-clipboard library falls back to browser clipboard APIs which are blocked in non-secure contexts (HTTP).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Feb 10, 2026): <!-- Answer --> The copy functionality for API secret keys is implemented in [`web/app/components/develop/secret-key/input-copy.tsx`](https://github.com/langgenius/dify/blob/7dabc03a08375488632b42440fb46edeed3c2a34/web/app/components/develop/secret-key/input-copy.tsx): ```tsx import copy from 'copy-to-clipboard' // Lines 41-44: The copy action onClick={() => { copy(value) setIsCopied(true) }} ``` The component uses the `copy-to-clipboard` npm library. There are two ways to copy: 1. **Clicking the text** (lines 39-52) - triggers `copy(value)` directly 2. **CopyFeedback button** (line 55) - uses `<CopyFeedback content={value} />` This component is used in [`secret-key-generate.tsx`](https://github.com/langgenius/dify/blob/7dabc03a08375488632b42440fb46edeed3c2a34/web/app/components/develop/secret-key/secret-key-generate.tsx#L31) to display the generated API token. The issue you're experiencing is likely due to the clipboard API requiring HTTPS. The `copy-to-clipboard` library falls back to browser clipboard APIs which are blocked in non-secure contexts (HTTP). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/57a8dcbf-ebb1-4bad-a3e4-6ae7b110dd23?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/57a8dcbf-ebb1-4bad-a3e4-6ae7b110dd23?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/57a8dcbf-ebb1-4bad-a3e4-6ae7b110dd23?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/57a8dcbf-ebb1-4bad-a3e4-6ae7b110dd23?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/57a8dcbf-ebb1-4bad-a3e4-6ae7b110dd23?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/57a8dcbf-ebb1-4bad-a3e4-6ae7b110dd23?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/57a8dcbf-ebb1-4bad-a3e4-6ae7b110dd23?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20copy%20functionality%20for%20API%20secret%20keys%20is%20implemented%20in%20%5B%60web/app/components/develop/secret-key/input-copy.tsx%60%5D%28https%3A//github.com/langgenius/dify/blob/7dabc03a08375488632b42440fb46edeed3c2a34/web/app/components/develop/secret-key/input-copy.tsx%29%3A%0A%0A%60%60%60tsx%0Aimport%20copy%20from%20%27copy-to-clipboard%27%0A%0A//%20Lines%2041-44%3A%20The%20copy%20action%0AonClick%3D%7B%28%29%20%3D%3E%20%7B%0A%20%20copy%28value%29%0A%20%20setIsCopied%28true%29%0A%7D%7D%0A%60%60%60%0A%0AThe%20component%20uses%20the%20%60copy-to-clipboard%60%20npm%20library.%20There%20are%20two%20ways%20to%20copy%3A%0A1.%20%2A%2AClicking%20the%20text%2A%2A%20%28lines%2039-52%29%20-%20triggers%20%60copy%28value%29%60%20directly%0A2.%20%2A%2ACopyFeedback%20button%2A%2A%20%28line%2055%29%20-%20uses%20%60%3CCopyFeedback%20content%3D%7Bvalue%7D%20/%3E%60%0A%0AThis%20component%20is%20used%20in%20%5B%60secret-key-generate.tsx%60%5D%28https%3A//github.com/langgenius/dify/blob/7dabc03a08375488632b42440fb46edeed3c2a34/web/app/components/develop/secret-key/secret-key-generate.tsx%23L31%29%20to%20display%20the%20generated%20API%20token.%0A%0AThe%20issue%20you%27re%20experiencing%20is%20likely%20due%20to%20the%20clipboard%20API%20requiring%20HTTPS.%20The%20%60copy-to-clipboard%60%20library%20falls%20back%20to%20browser%20clipboard%20APIs%20which%20are%20blocked%20in%20non-secure%20contexts%20%28HTTP%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/32172)
Author
Owner

@crazywoola commented on GitHub (Feb 11, 2026):

Updates: It seems that this is not working on Windows.

@crazywoola commented on GitHub (Feb 11, 2026): Updates: It seems that this is not working on Windows.
Author
Owner

@Gnywin commented on GitHub (Feb 11, 2026):

Updates: It seems that this is not working on Windows.

yes ,I deployed it on windows

@Gnywin commented on GitHub (Feb 11, 2026): > Updates: It seems that this is not working on Windows. yes ,I deployed it on windows
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22165