snowflake_sql plugin OAuth client Id corruption #883

Closed
opened 2026-02-16 10:20:50 -05:00 by yindo · 13 comments
Owner

Originally created by @HABE-WAKAM on GitHub (Dec 18, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues Dify issues & Dify Official Plugins, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.10.1

Plugin version

0.0.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Follow the configuration steps on the README page, creating the security Integration on snowflake and using the right parameters on the snowflake_sql plugin.

✔️ Error log

I have this error when trying to start the integration.
OAuth client integration with the given client id is not found.

Image

When investigating the issue I noticed that the client_id used in the URI is not the same that is configured. That's why snowflake does not recognise it.

Originally created by @HABE-WAKAM on GitHub (Dec 18, 2025). ### Self Checks - [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 [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.10.1 ### Plugin version 0.0.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Follow the configuration steps on the README page, creating the security Integration on snowflake and using the right parameters on the snowflake_sql plugin. ### ✔️ Error log I have this error when trying to start the integration. OAuth client integration with the given client id is not found. <img width="1194" height="1204" alt="Image" src="https://github.com/user-attachments/assets/fbe73063-139c-4f4d-9304-b57cad048cbd" /> When investigating the issue I noticed that the client_id used in the URI is not the same that is configured. That's why snowflake does not recognise it.
yindo added the bug label 2026-02-16 10:20:50 -05:00
yindo closed this issue 2026-02-16 10:20:50 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 18, 2025):

The snowflake_sql plugin uses the OAuth client_id exactly as configured in its settings—there’s no mutation or overwriting in the plugin code. If the client_id in the OAuth URI doesn’t match what you configured, it’s almost always due to a misconfiguration in the Dify backend or a mismatch between what’s registered in Snowflake and what Dify is actually using.

Here’s a checklist to resolve this:

  1. Double-check that the client_id you entered in the plugin matches exactly the one from Snowflake’s SYSTEM$SHOW_OAUTH_CLIENT_SECRETS output and that it’s saved in the plugin configuration.
  2. Make sure the redirect URI registered in Snowflake is an exact match (protocol, domain, port, and path) to what Dify constructs. The URI should be:
    {your CONSOLE_API_URL}/console/api/oauth/plugin/langgenius/snowflake_sql/snowflake_sql/tool/callback
    
    Even a small difference (like http vs https, missing port, or a trailing slash) will cause a mismatch and failure. See this reference.
  3. If you’re running Dify via Docker, ensure the CONSOLE_API_URL environment variable is set correctly to your public domain in your .env or Docker Compose file, and restart all containers after making changes. This variable is used to build the redirect URI and impacts OAuth flows for all plugins (example).
  4. If you’ve updated the client_id or redirect URI, restart your Docker containers to ensure the new values are loaded.
  5. If the issue persists, check the ToolOAuthTenantClient table in your database to confirm the stored client_id matches what you expect. Sometimes, the backend may still be using a default/system client if the tenant-specific one isn’t enabled or set up correctly (plugin config reference).

If you follow these steps and ensure all values match exactly, the OAuth integration should work as expected. If you’re still seeing mismatches, let me know what values you see in the database and your environment, and I can help you dig deeper.

To reply, just mention @dosu.


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

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 18, 2025): <!-- Answer --> The snowflake_sql plugin uses the OAuth client_id exactly as configured in its settings—there’s no mutation or overwriting in the plugin code. If the client_id in the OAuth URI doesn’t match what you configured, it’s almost always due to a misconfiguration in the Dify backend or a mismatch between what’s registered in Snowflake and what Dify is actually using. Here’s a checklist to resolve this: 1. Double-check that the client_id you entered in the plugin matches exactly the one from Snowflake’s SYSTEM$SHOW_OAUTH_CLIENT_SECRETS output and that it’s saved in the plugin configuration. 2. Make sure the redirect URI registered in Snowflake is an exact match (protocol, domain, port, and path) to what Dify constructs. The URI should be: ``` {your CONSOLE_API_URL}/console/api/oauth/plugin/langgenius/snowflake_sql/snowflake_sql/tool/callback ``` Even a small difference (like http vs https, missing port, or a trailing slash) will cause a mismatch and failure. See [this reference](https://github.com/langgenius/dify-official-plugins/issues/2139). 3. If you’re running Dify via Docker, ensure the CONSOLE_API_URL environment variable is set correctly to your public domain in your `.env` or Docker Compose file, and restart all containers after making changes. This variable is used to build the redirect URI and impacts OAuth flows for all plugins ([example](https://github.com/langgenius/dify/issues/26796)). 4. If you’ve updated the client_id or redirect URI, restart your Docker containers to ensure the new values are loaded. 5. If the issue persists, check the ToolOAuthTenantClient table in your database to confirm the stored client_id matches what you expect. Sometimes, the backend may still be using a default/system client if the tenant-specific one isn’t enabled or set up correctly ([plugin config reference](https://github.com/langgenius/dify-official-plugins/blob/6ec14c4625f9095fe84ea7a616f5a119fc04627a/tools/snowflake/provider/snowflake_sql.yaml#L15-L63)). If you follow these steps and ensure all values match exactly, the OAuth integration should work as expected. If you’re still seeing mismatches, let me know what values you see in the database and your environment, and I can help you dig deeper. <!-- 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/2009916f-ad31-4031-90ba-80d106e02bdc?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/2009916f-ad31-4031-90ba-80d106e02bdc?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/2009916f-ad31-4031-90ba-80d106e02bdc?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/2009916f-ad31-4031-90ba-80d106e02bdc?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/2009916f-ad31-4031-90ba-80d106e02bdc?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/2009916f-ad31-4031-90ba-80d106e02bdc?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/2009916f-ad31-4031-90ba-80d106e02bdc?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20snowflake_sql%20plugin%20uses%20the%20OAuth%20client_id%20exactly%20as%20configured%20in%20its%20settings%E2%80%94there%E2%80%99s%20no%20mutation%20or%20overwriting%20in%20the%20plugin%20code.%20If%20the%20client_id%20in%20the%20OAuth%20URI%20doesn%E2%80%99t%20match%20what%20you%20configured%2C%20it%E2%80%99s%20almost%20always%20due%20to%20a%20misconfiguration%20in%20the%20Dify%20backend%20or%20a%20mismatch%20between%20what%E2%80%99s%20registered%20in%20Snowflake%20and%20what%20Dify%20is%20actually%20using.%0A%0AHere%E2%80%99s%20a%20checklist%20to%20resolve%20this%3A%0A%0A1.%20Double-check%20that%20the%20client_id%20you%20entered%20in%20the%20plugin%20matches%20exactly%20the%20one%20from%20Snowflake%E2%80%99s%20SYSTEM%24SHOW_OAUTH_CLIENT_SECRETS%20output%20and%20that%20it%E2%80%99s%20saved%20in%20the%20plugin%20configuration.%0A2.%20Make%20sure%20the%20redirect%20URI%20registered%20in%20Snowflake%20is%20an%20exact%20match%20%28protocol%2C%20domain%2C%20port%2C%20and%20path%29%20to%20what%20Dify%20constructs.%20The%20URI%20should%20be%3A%0A%20%20%20%60%60%60%0A%20%20%20%7Byour%20CONSOLE_API_URL%7D/console/api/oauth/plugin/langgenius/snowflake_sql/snowflake_sql/tool/callback%0A%20%20%20%60%60%60%0A%20%20%20Even%20a%20small%20difference%20%28like%20http%20vs%20https%2C%20missing%20port%2C%20or%20a%20trailing%20slash%29%20will%20cause%20a%20mismatch%20and%20failure.%20See%20%5Bthis%20reference%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2139%29.%0A3.%20If%20you%E2%80%99re%20running%20Dify%20via%20Docker%2C%20ensure%20the%20CONSOLE_API_URL%20environment%20variable%20is%20set%20correctly%20to%20your%20public%20domain%20in%20your%20%60.env%60%20or%20Docker%20Compose%20file%2C%20and%20restart%20all%20containers%20after%20making%20changes.%20This%20variable%20is%20used%20to%20build%20the%20redirect%20URI%20and%20impacts%20OAuth%20flows%20for%20all%20plugins%20%28%5Bexample%5D%28https%3A//github.com/langgenius/dify/issues/26796%29%29.%0A4.%20If%20you%E2%80%99ve%20updated%20the%20client_id%20or%20redirect%20URI%2C%20restart%20your%20Docker%20containers%20to%20ensure%20the%20new%20values%20are%20loaded.%0A5.%20If%20the%20issue%20persists%2C%20check%20the%20ToolOAuthTenantClient%20table%20in%20your%20database%20to%20confirm%20the%20stored%20client_id%20matches%20what%20you%20expect.%20Sometimes%2C%20the%20backend%20may%20still%20be%20using%20a%20default/system%20client%20if%20the%20tenant-specific%20one%20isn%E2%80%99t%20enabled%20or%20set%20up%20correctly%20%28%5Bplugin%20config%20reference%5D%28https%3A//github.com/langgenius/dify-official-plugins/blob/6ec14c4625f9095fe84ea7a616f5a119fc04627a/tools/snowflake/provider/snowflake_sql.yaml%23L15-L63%29%29.%0A%0AIf%20you%20follow%20these%20steps%20and%20ensure%20all%20values%20match%20exactly%2C%20the%20OAuth%20integration%20should%20work%20as%20expected.%20If%20you%E2%80%99re%20still%20seeing%20mismatches%2C%20let%20me%20know%20what%20values%20you%20see%20in%20the%20database%20and%20your%20environment%2C%20and%20I%20can%20help%20you%20dig%20deeper.)&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-official-plugins/issues/2288)
Author
Owner

@HABE-WAKAM commented on GitHub (Dec 19, 2025):

@dosu I checked in the table Tool_OAuth_Tenant_Client and I saw that the client_id and client_secret values are like encoded in a way and are not equal to the values I configured. Is there any sort of hashing or encoding that is applied when inserting values in that table ?

@HABE-WAKAM commented on GitHub (Dec 19, 2025): @dosu I checked in the table Tool_OAuth_Tenant_Client and I saw that the client_id and client_secret values are like encoded in a way and are not equal to the values I configured. Is there any sort of hashing or encoding that is applied when inserting values in that table ?
Author
Owner

@dosubot[bot] commented on GitHub (Dec 19, 2025):

Yes, the client_id and client_secret values in the Tool_OAuth_Tenant_Client table are encrypted before being stored, not just encoded or hashed. Dify uses AES-CBC encryption with a key derived from the application's SECRET_KEY, and the encrypted data is base64-encoded—so the values in the table will look very different from what you entered. This encryption is reversible and handled automatically by Dify, so the original values are restored when needed for OAuth operations. This is a security feature and expected behavior, not a bug or misconfiguration. As long as you entered the correct credentials, Dify will use them correctly during OAuth flows. You can see the encryption logic in the code here: provider_encryption.py and system_oauth_encryption.py.

To reply, just mention @dosu.


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

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 19, 2025): <!-- Answer --> Yes, the client_id and client_secret values in the Tool_OAuth_Tenant_Client table are encrypted before being stored, not just encoded or hashed. Dify uses AES-CBC encryption with a key derived from the application's SECRET_KEY, and the encrypted data is base64-encoded—so the values in the table will look very different from what you entered. This encryption is reversible and handled automatically by Dify, so the original values are restored when needed for OAuth operations. This is a security feature and expected behavior, not a bug or misconfiguration. As long as you entered the correct credentials, Dify will use them correctly during OAuth flows. You can see the encryption logic in the code here: [provider_encryption.py](https://github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/helper/provider_encryption.py#L49-L125) and [system_oauth_encryption.py](https://github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/tools/utils/system_oauth_encryption.py#L23-L187). <!-- 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/f3c7e20c-2233-43f3-b3f0-375019f8e425?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f3c7e20c-2233-43f3-b3f0-375019f8e425?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f3c7e20c-2233-43f3-b3f0-375019f8e425?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f3c7e20c-2233-43f3-b3f0-375019f8e425?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f3c7e20c-2233-43f3-b3f0-375019f8e425?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f3c7e20c-2233-43f3-b3f0-375019f8e425?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f3c7e20c-2233-43f3-b3f0-375019f8e425?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Yes%2C%20the%20client_id%20and%20client_secret%20values%20in%20the%20Tool_OAuth_Tenant_Client%20table%20are%20encrypted%20before%20being%20stored%2C%20not%20just%20encoded%20or%20hashed.%20Dify%20uses%20AES-CBC%20encryption%20with%20a%20key%20derived%20from%20the%20application%27s%20SECRET_KEY%2C%20and%20the%20encrypted%20data%20is%20base64-encoded%E2%80%94so%20the%20values%20in%20the%20table%20will%20look%20very%20different%20from%20what%20you%20entered.%20This%20encryption%20is%20reversible%20and%20handled%20automatically%20by%20Dify%2C%20so%20the%20original%20values%20are%20restored%20when%20needed%20for%20OAuth%20operations.%20This%20is%20a%20security%20feature%20and%20expected%20behavior%2C%20not%20a%20bug%20or%20misconfiguration.%20As%20long%20as%20you%20entered%20the%20correct%20credentials%2C%20Dify%20will%20use%20them%20correctly%20during%20OAuth%20flows.%20You%20can%20see%20the%20encryption%20logic%20in%20the%20code%20here%3A%20%5Bprovider_encryption.py%5D%28https%3A//github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/helper/provider_encryption.py%23L49-L125%29%20and%20%5Bsystem_oauth_encryption.py%5D%28https%3A//github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/tools/utils/system_oauth_encryption.py%23L23-L187%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-official-plugins/issues/2288)
Author
Owner

@HABE-WAKAM commented on GitHub (Dec 19, 2025):

@dosu when the authentication popup appears, I see that it is using the encrypted values in the URI and not the decrypted ones. Is this normal ?

@HABE-WAKAM commented on GitHub (Dec 19, 2025): @dosu when the authentication popup appears, I see that it is using the encrypted values in the URI and not the decrypted ones. Is this normal ?
Author
Owner

@dosubot[bot] commented on GitHub (Dec 19, 2025):

No, it's not normal for the authentication popup to use encrypted values in the OAuth URI—those values should be decrypted (plaintext) before being sent. Dify encrypts sensitive credentials like client_id and client_secret in the database for security, but always decrypts them before using them in OAuth flows. If you see encrypted (base64-like) values in the URI, it usually means the decryption step failed or the wrong value is being read, which could be due to an incorrect SECRET_KEY, cache issues, or a misconfiguration in the plugin or tenant setup.

Check that your SECRET_KEY is consistent across all services, restart your containers, and make sure the correct tenant and plugin configuration is being used. Also, look for any error logs related to decryption failures during the OAuth flow—those can help pinpoint the issue. If you can share any relevant logs or config details, I can help you dig deeper.

For more on how Dify handles this, see the code for decryption and OAuth flow:

To reply, just mention @dosu.


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

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 19, 2025): <!-- Answer --> No, it's not normal for the authentication popup to use encrypted values in the OAuth URI—those values should be decrypted (plaintext) before being sent. Dify encrypts sensitive credentials like client_id and client_secret in the database for security, but always decrypts them before using them in OAuth flows. If you see encrypted (base64-like) values in the URI, it usually means the decryption step failed or the wrong value is being read, which could be due to an incorrect SECRET_KEY, cache issues, or a misconfiguration in the plugin or tenant setup. Check that your SECRET_KEY is consistent across all services, restart your containers, and make sure the correct tenant and plugin configuration is being used. Also, look for any error logs related to decryption failures during the OAuth flow—those can help pinpoint the issue. If you can share any relevant logs or config details, I can help you dig deeper. For more on how Dify handles this, see the code for decryption and OAuth flow: - [Decryption logic](https://github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/tools/utils/system_oauth_encryption.py#L23-L130) - [How decrypted values are used in the plugin](https://github.com/langgenius/dify-official-plugins/blob/dca4a9890662c2f7e93893eb0e82128ccfb73e18/tools/snowflake/provider/snowflake_sql.py#L20-L80) <!-- 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/f6ff7db5-1f54-4ea7-b8d6-f5e4568f9e40?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f6ff7db5-1f54-4ea7-b8d6-f5e4568f9e40?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f6ff7db5-1f54-4ea7-b8d6-f5e4568f9e40?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f6ff7db5-1f54-4ea7-b8d6-f5e4568f9e40?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f6ff7db5-1f54-4ea7-b8d6-f5e4568f9e40?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f6ff7db5-1f54-4ea7-b8d6-f5e4568f9e40?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f6ff7db5-1f54-4ea7-b8d6-f5e4568f9e40?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=No%2C%20it%27s%20not%20normal%20for%20the%20authentication%20popup%20to%20use%20encrypted%20values%20in%20the%20OAuth%20URI%E2%80%94those%20values%20should%20be%20decrypted%20%28plaintext%29%20before%20being%20sent.%20Dify%20encrypts%20sensitive%20credentials%20like%20client_id%20and%20client_secret%20in%20the%20database%20for%20security%2C%20but%20always%20decrypts%20them%20before%20using%20them%20in%20OAuth%20flows.%20If%20you%20see%20encrypted%20%28base64-like%29%20values%20in%20the%20URI%2C%20it%20usually%20means%20the%20decryption%20step%20failed%20or%20the%20wrong%20value%20is%20being%20read%2C%20which%20could%20be%20due%20to%20an%20incorrect%20SECRET_KEY%2C%20cache%20issues%2C%20or%20a%20misconfiguration%20in%20the%20plugin%20or%20tenant%20setup.%0A%0ACheck%20that%20your%20SECRET_KEY%20is%20consistent%20across%20all%20services%2C%20restart%20your%20containers%2C%20and%20make%20sure%20the%20correct%20tenant%20and%20plugin%20configuration%20is%20being%20used.%20Also%2C%20look%20for%20any%20error%20logs%20related%20to%20decryption%20failures%20during%20the%20OAuth%20flow%E2%80%94those%20can%20help%20pinpoint%20the%20issue.%20If%20you%20can%20share%20any%20relevant%20logs%20or%20config%20details%2C%20I%20can%20help%20you%20dig%20deeper.%0A%0AFor%20more%20on%20how%20Dify%20handles%20this%2C%20see%20the%20code%20for%20decryption%20and%20OAuth%20flow%3A%0A-%20%5BDecryption%20logic%5D%28https%3A//github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/tools/utils/system_oauth_encryption.py%23L23-L130%29%0A-%20%5BHow%20decrypted%20values%20are%20used%20in%20the%20plugin%5D%28https%3A//github.com/langgenius/dify-official-plugins/blob/dca4a9890662c2f7e93893eb0e82128ccfb73e18/tools/snowflake/provider/snowflake_sql.py%23L20-L80%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-official-plugins/issues/2288)
Author
Owner

@HABE-WAKAM commented on GitHub (Dec 19, 2025):

@dosu can you give me steps to check the possible issues ?

@HABE-WAKAM commented on GitHub (Dec 19, 2025): @dosu can you give me steps to check the possible issues ?
Author
Owner

@dosubot[bot] commented on GitHub (Dec 19, 2025):

Here’s a step-by-step checklist to help you diagnose why encrypted values are appearing in the OAuth URI for the Snowflake plugin:

  1. SECRET_KEY Consistency: Make sure the SECRET_KEY environment variable is set to the exact same value across all Dify services and containers. If the key is different anywhere, decryption will fail and you’ll see encrypted values in the OAuth URI instead of the real client_id and client_secret. Restart all containers after confirming this.

  2. Plugin/Tenant Configuration: Double-check that the Snowflake plugin is using the correct tenant and plugin configuration. Sometimes, the backend may use a default/system client if the tenant-specific one isn’t enabled or set up correctly.

  3. Database Values: In the Tool_OAuth_Tenant_Client table, the client_id and client_secret are stored encrypted (base64-encoded AES-CBC). This is normal, but when Dify fetches them for OAuth, it should decrypt them before use. If you see encrypted values in the OAuth URI, it means the decryption step failed upstream (not in the plugin itself) reference.

  4. Restart After Changes: If you change any environment variables (especially SECRET_KEY or CONSOLE_API_URL), or update plugin credentials, you must restart all Dify containers to ensure the new values are loaded everywhere.

  5. Check Error Logs: Look for error logs in your Dify backend during the OAuth flow. Specifically, search for decryption errors or exceptions related to the SystemOAuthEncrypter or get_oauth_client. These will help pinpoint if the SECRET_KEY is wrong or if there’s a problem with the encrypted data reference.

  6. Redirect URI Match: Ensure the redirect URI registered in Snowflake matches exactly what Dify constructs (protocol, domain, port, and path). Even a small mismatch will cause OAuth failures, but this won’t cause encrypted values in the URI—it’s just another common source of OAuth errors reference.

  7. Cache/Credential Refresh: If you recently updated credentials or configuration, clear any relevant caches and restart services to force Dify to reload the latest values.

If you follow these steps and still see encrypted values in the OAuth URI, focus on SECRET_KEY mismatches and check for decryption errors in your logs. The plugin itself always expects decrypted values—if it gets encrypted ones, the problem is upstream in the backend or environment.

To reply, just mention @dosu.


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

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 19, 2025): <!-- Answer --> Here’s a step-by-step checklist to help you diagnose why encrypted values are appearing in the OAuth URI for the Snowflake plugin: 1. **SECRET_KEY Consistency**: Make sure the SECRET_KEY environment variable is set to the exact same value across all Dify services and containers. If the key is different anywhere, decryption will fail and you’ll see encrypted values in the OAuth URI instead of the real client_id and client_secret. Restart all containers after confirming this. 2. **Plugin/Tenant Configuration**: Double-check that the Snowflake plugin is using the correct tenant and plugin configuration. Sometimes, the backend may use a default/system client if the tenant-specific one isn’t enabled or set up correctly. 3. **Database Values**: In the Tool_OAuth_Tenant_Client table, the client_id and client_secret are stored encrypted (base64-encoded AES-CBC). This is normal, but when Dify fetches them for OAuth, it should decrypt them before use. If you see encrypted values in the OAuth URI, it means the decryption step failed upstream (not in the plugin itself) [reference](https://github.com/langgenius/dify-official-plugins/blob/dca4a9890662c2f7e93893eb0e82128ccfb73e18/tools/snowflake/provider/snowflake_sql.py#L20-L43). 4. **Restart After Changes**: If you change any environment variables (especially SECRET_KEY or CONSOLE_API_URL), or update plugin credentials, you must restart all Dify containers to ensure the new values are loaded everywhere. 5. **Check Error Logs**: Look for error logs in your Dify backend during the OAuth flow. Specifically, search for decryption errors or exceptions related to the SystemOAuthEncrypter or get_oauth_client. These will help pinpoint if the SECRET_KEY is wrong or if there’s a problem with the encrypted data [reference](https://github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/tools/utils/system_oauth_encryption.py#L23-L160). 6. **Redirect URI Match**: Ensure the redirect URI registered in Snowflake matches exactly what Dify constructs (protocol, domain, port, and path). Even a small mismatch will cause OAuth failures, but this won’t cause encrypted values in the URI—it’s just another common source of OAuth errors [reference](https://github.com/langgenius/dify-official-plugins/issues/2139). 7. **Cache/Credential Refresh**: If you recently updated credentials or configuration, clear any relevant caches and restart services to force Dify to reload the latest values. If you follow these steps and still see encrypted values in the OAuth URI, focus on SECRET_KEY mismatches and check for decryption errors in your logs. The plugin itself always expects decrypted values—if it gets encrypted ones, the problem is upstream in the backend or environment. <!-- 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/67d4bdf4-de6b-4e16-8237-26fbdd206d93?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/67d4bdf4-de6b-4e16-8237-26fbdd206d93?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/67d4bdf4-de6b-4e16-8237-26fbdd206d93?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/67d4bdf4-de6b-4e16-8237-26fbdd206d93?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/67d4bdf4-de6b-4e16-8237-26fbdd206d93?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/67d4bdf4-de6b-4e16-8237-26fbdd206d93?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/67d4bdf4-de6b-4e16-8237-26fbdd206d93?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Here%E2%80%99s%20a%20step-by-step%20checklist%20to%20help%20you%20diagnose%20why%20encrypted%20values%20are%20appearing%20in%20the%20OAuth%20URI%20for%20the%20Snowflake%20plugin%3A%0A%0A1.%20%2A%2ASECRET_KEY%20Consistency%2A%2A%3A%20Make%20sure%20the%20SECRET_KEY%20environment%20variable%20is%20set%20to%20the%20exact%20same%20value%20across%20all%20Dify%20services%20and%20containers.%20If%20the%20key%20is%20different%20anywhere%2C%20decryption%20will%20fail%20and%20you%E2%80%99ll%20see%20encrypted%20values%20in%20the%20OAuth%20URI%20instead%20of%20the%20real%20client_id%20and%20client_secret.%20Restart%20all%20containers%20after%20confirming%20this.%0A%0A2.%20%2A%2APlugin/Tenant%20Configuration%2A%2A%3A%20Double-check%20that%20the%20Snowflake%20plugin%20is%20using%20the%20correct%20tenant%20and%20plugin%20configuration.%20Sometimes%2C%20the%20backend%20may%20use%20a%20default/system%20client%20if%20the%20tenant-specific%20one%20isn%E2%80%99t%20enabled%20or%20set%20up%20correctly.%0A%0A3.%20%2A%2ADatabase%20Values%2A%2A%3A%20In%20the%20Tool_OAuth_Tenant_Client%20table%2C%20the%20client_id%20and%20client_secret%20are%20stored%20encrypted%20%28base64-encoded%20AES-CBC%29.%20This%20is%20normal%2C%20but%20when%20Dify%20fetches%20them%20for%20OAuth%2C%20it%20should%20decrypt%20them%20before%20use.%20If%20you%20see%20encrypted%20values%20in%20the%20OAuth%20URI%2C%20it%20means%20the%20decryption%20step%20failed%20upstream%20%28not%20in%20the%20plugin%20itself%29%20%5Breference%5D%28https%3A//github.com/langgenius/dify-official-plugins/blob/dca4a9890662c2f7e93893eb0e82128ccfb73e18/tools/snowflake/provider/snowflake_sql.py%23L20-L43%29.%0A%0A4.%20%2A%2ARestart%20After%20Changes%2A%2A%3A%20If%20you%20change%20any%20environment%20variables%20%28especially%20SECRET_KEY%20or%20CONSOLE_API_URL%29%2C%20or%20update%20plugin%20credentials%2C%20you%20must%20restart%20all%20Dify%20containers%20to%20ensure%20the%20new%20values%20are%20loaded%20everywhere.%0A%0A5.%20%2A%2ACheck%20Error%20Logs%2A%2A%3A%20Look%20for%20error%20logs%20in%20your%20Dify%20backend%20during%20the%20OAuth%20flow.%20Specifically%2C%20search%20for%20decryption%20errors%20or%20exceptions%20related%20to%20the%20SystemOAuthEncrypter%20or%20get_oauth_client.%20These%20will%20help%20pinpoint%20if%20the%20SECRET_KEY%20is%20wrong%20or%20if%20there%E2%80%99s%20a%20problem%20with%20the%20encrypted%20data%20%5Breference%5D%28https%3A//github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/tools/utils/system_oauth_encryption.py%23L23-L160%29.%0A%0A6.%20%2A%2ARedirect%20URI%20Match%2A%2A%3A%20Ensure%20the%20redirect%20URI%20registered%20in%20Snowflake%20matches%20exactly%20what%20Dify%20constructs%20%28protocol%2C%20domain%2C%20port%2C%20and%20path%29.%20Even%20a%20small%20mismatch%20will%20cause%20OAuth%20failures%2C%20but%20this%20won%E2%80%99t%20cause%20encrypted%20values%20in%20the%20URI%E2%80%94it%E2%80%99s%20just%20another%20common%20source%20of%20OAuth%20errors%20%5Breference%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2139%29.%0A%0A7.%20%2A%2ACache/Credential%20Refresh%2A%2A%3A%20If%20you%20recently%20updated%20credentials%20or%20configuration%2C%20clear%20any%20relevant%20caches%20and%20restart%20services%20to%20force%20Dify%20to%20reload%20the%20latest%20values.%0A%0AIf%20you%20follow%20these%20steps%20and%20still%20see%20encrypted%20values%20in%20the%20OAuth%20URI%2C%20focus%20on%20SECRET_KEY%20mismatches%20and%20check%20for%20decryption%20errors%20in%20your%20logs.%20The%20plugin%20itself%20always%20expects%20decrypted%20values%E2%80%94if%20it%20gets%20encrypted%20ones%2C%20the%20problem%20is%20upstream%20in%20the%20backend%20or%20environment.)&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-official-plugins/issues/2288)
Author
Owner

@HABE-WAKAM commented on GitHub (Dec 19, 2025):

@dosu can you explain how the client_id is being used in the code, at which moment in the code is it decoded when executing the OAuth flow ?

@HABE-WAKAM commented on GitHub (Dec 19, 2025): @dosu can you explain how the client_id is being used in the code, at which moment in the code is it decoded when executing the OAuth flow ?
Author
Owner

@dosubot[bot] commented on GitHub (Dec 19, 2025):

Here’s how it works in the code:

The client_id is stored encrypted in the ToolOAuthTenantClient table. When the OAuth flow starts, the Dify backend (specifically, the get_oauth_client method in BuiltinToolManageService) fetches this record and decrypts the oauth_params—including client_id—using a provider-specific encrypter (SystemOAuthEncrypter, which uses your SECRET_KEY) before returning them for use in the OAuth process. This decryption happens before any plugin code runs, so the plugin only ever receives the plaintext client_id in the system_credentials dictionary. The snowflake_sql plugin then uses this decrypted client_id directly to build the OAuth authorization URL and for token exchange—there’s no decryption logic in the plugin itself.

If you see encrypted values in the OAuth URI, it means the decryption step failed upstream (usually due to a SECRET_KEY mismatch or misconfiguration), not in the plugin code itself.

To reply, just mention @dosu.


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

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 19, 2025): <!-- Answer --> Here’s how it works in the code: The client_id is stored encrypted in the ToolOAuthTenantClient table. When the OAuth flow starts, the Dify backend (specifically, the get_oauth_client method in BuiltinToolManageService) fetches this record and decrypts the oauth_params—including client_id—using a provider-specific encrypter (SystemOAuthEncrypter, which uses your SECRET_KEY) before returning them for use in the OAuth process. This decryption happens before any plugin code runs, so the plugin only ever receives the plaintext client_id in the system_credentials dictionary. The snowflake_sql plugin then uses this decrypted client_id directly to build the OAuth authorization URL and for token exchange—there’s no decryption logic in the plugin itself. If you see encrypted values in the OAuth URI, it means the decryption step failed upstream (usually due to a SECRET_KEY mismatch or misconfiguration), not in the plugin code itself. - [get_oauth_client decryption logic](https://github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/services/tools/builtin_tools_manage_service.py#L475-L521) - [SystemOAuthEncrypter decryption details](https://github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/tools/utils/system_oauth_encryption.py#L23-L187) - [How the plugin uses the decrypted client_id](https://github.com/langgenius/dify-official-plugins/blob/dca4a9890662c2f7e93893eb0e82128ccfb73e18/tools/snowflake/provider/snowflake_sql.py#L19-L171) <!-- 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/261a4587-b80c-4cc8-b2a3-42714330dae8?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/261a4587-b80c-4cc8-b2a3-42714330dae8?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/261a4587-b80c-4cc8-b2a3-42714330dae8?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/261a4587-b80c-4cc8-b2a3-42714330dae8?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/261a4587-b80c-4cc8-b2a3-42714330dae8?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/261a4587-b80c-4cc8-b2a3-42714330dae8?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/261a4587-b80c-4cc8-b2a3-42714330dae8?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Here%E2%80%99s%20how%20it%20works%20in%20the%20code%3A%0A%0AThe%20client_id%20is%20stored%20encrypted%20in%20the%20ToolOAuthTenantClient%20table.%20When%20the%20OAuth%20flow%20starts%2C%20the%20Dify%20backend%20%28specifically%2C%20the%20get_oauth_client%20method%20in%20BuiltinToolManageService%29%20fetches%20this%20record%20and%20decrypts%20the%20oauth_params%E2%80%94including%20client_id%E2%80%94using%20a%20provider-specific%20encrypter%20%28SystemOAuthEncrypter%2C%20which%20uses%20your%20SECRET_KEY%29%20before%20returning%20them%20for%20use%20in%20the%20OAuth%20process.%20This%20decryption%20happens%20before%20any%20plugin%20code%20runs%2C%20so%20the%20plugin%20only%20ever%20receives%20the%20plaintext%20client_id%20in%20the%20system_credentials%20dictionary.%20The%20snowflake_sql%20plugin%20then%20uses%20this%20decrypted%20client_id%20directly%20to%20build%20the%20OAuth%20authorization%20URL%20and%20for%20token%20exchange%E2%80%94there%E2%80%99s%20no%20decryption%20logic%20in%20the%20plugin%20itself.%20%0A%0AIf%20you%20see%20encrypted%20values%20in%20the%20OAuth%20URI%2C%20it%20means%20the%20decryption%20step%20failed%20upstream%20%28usually%20due%20to%20a%20SECRET_KEY%20mismatch%20or%20misconfiguration%29%2C%20not%20in%20the%20plugin%20code%20itself.%20%20%0A-%20%5Bget_oauth_client%20decryption%20logic%5D%28https%3A//github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/services/tools/builtin_tools_manage_service.py%23L475-L521%29%0A-%20%5BSystemOAuthEncrypter%20decryption%20details%5D%28https%3A//github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/api/core/tools/utils/system_oauth_encryption.py%23L23-L187%29%0A-%20%5BHow%20the%20plugin%20uses%20the%20decrypted%20client_id%5D%28https%3A//github.com/langgenius/dify-official-plugins/blob/dca4a9890662c2f7e93893eb0e82128ccfb73e18/tools/snowflake/provider/snowflake_sql.py%23L19-L171%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-official-plugins/issues/2288)
Author
Owner

@HABE-WAKAM commented on GitHub (Dec 19, 2025):

@dosu in which containers should the SECRET_KEY variable should be set ?

@HABE-WAKAM commented on GitHub (Dec 19, 2025): @dosu in which containers should the SECRET_KEY variable should be set ?
Author
Owner

@dosubot[bot] commented on GitHub (Dec 19, 2025):

SECRET_KEY must be set in all containers that handle backend logic for Dify, specifically: api (backend), worker (Celery worker), worker_beat (Celery beat), and plugin_daemon. These containers use SECRET_KEY to encrypt and decrypt sensitive data like OAuth credentials. Make sure the value is identical in each container’s environment (usually via your .env file and Docker Compose), and restart all containers after any change. If SECRET_KEY is missing or mismatched, decryption will fail and you’ll see issues like encrypted values leaking into OAuth URIs, causing authentication errors. Frontend/web containers do not require SECRET_KEY for this purpose.
Reference: docker-compose.yaml | Reference: .env.example

To reply, just mention @dosu.


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

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 19, 2025): <!-- Answer --> SECRET_KEY must be set in all containers that handle backend logic for Dify, specifically: api (backend), worker (Celery worker), worker_beat (Celery beat), and plugin_daemon. These containers use SECRET_KEY to encrypt and decrypt sensitive data like OAuth credentials. Make sure the value is identical in each container’s environment (usually via your .env file and Docker Compose), and restart all containers after any change. If SECRET_KEY is missing or mismatched, decryption will fail and you’ll see issues like encrypted values leaking into OAuth URIs, causing authentication errors. Frontend/web containers do not require SECRET_KEY for this purpose. [Reference: docker-compose.yaml](https://github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/docker/docker-compose.yaml#L7-L1010) | [Reference: .env.example](https://github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/docker/.env.example#L2-L99) <!-- 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/fa37729c-0b61-4a14-881e-89106c8d2007?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/fa37729c-0b61-4a14-881e-89106c8d2007?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/fa37729c-0b61-4a14-881e-89106c8d2007?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/fa37729c-0b61-4a14-881e-89106c8d2007?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fa37729c-0b61-4a14-881e-89106c8d2007?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/fa37729c-0b61-4a14-881e-89106c8d2007?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/fa37729c-0b61-4a14-881e-89106c8d2007?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=SECRET_KEY%20must%20be%20set%20in%20all%20containers%20that%20handle%20backend%20logic%20for%20Dify%2C%20specifically%3A%20api%20%28backend%29%2C%20worker%20%28Celery%20worker%29%2C%20worker_beat%20%28Celery%20beat%29%2C%20and%20plugin_daemon.%20These%20containers%20use%20SECRET_KEY%20to%20encrypt%20and%20decrypt%20sensitive%20data%20like%20OAuth%20credentials.%20Make%20sure%20the%20value%20is%20identical%20in%20each%20container%E2%80%99s%20environment%20%28usually%20via%20your%20.env%20file%20and%20Docker%20Compose%29%2C%20and%20restart%20all%20containers%20after%20any%20change.%20If%20SECRET_KEY%20is%20missing%20or%20mismatched%2C%20decryption%20will%20fail%20and%20you%E2%80%99ll%20see%20issues%20like%20encrypted%20values%20leaking%20into%20OAuth%20URIs%2C%20causing%20authentication%20errors.%20Frontend/web%20containers%20do%20not%20require%20SECRET_KEY%20for%20this%20purpose.%20%20%0A%5BReference%3A%20docker-compose.yaml%5D%28https%3A//github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/docker/docker-compose.yaml%23L7-L1010%29%20%7C%20%5BReference%3A%20.env.example%5D%28https%3A//github.com/langgenius/dify/blob/4320503209b1ded13bf6b2c98a112d65950428ac/docker/.env.example%23L2-L99%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-official-plugins/issues/2288)
Author
Owner

@HABE-WAKAM commented on GitHub (Dec 19, 2025):

@dosu where should I configure this SECRET_KEY variable knowing that I use kubernetes to deploy dify

@HABE-WAKAM commented on GitHub (Dec 19, 2025): @dosu where should I configure this SECRET_KEY variable knowing that I use kubernetes to deploy dify
Author
Owner

@dosubot[bot] commented on GitHub (Dec 19, 2025):

You should store SECRET_KEY as a Kubernetes Secret and inject it into all Dify backend pods that handle encryption/decryption (api, worker, worker_beat, plugin_daemon). Here’s a typical approach:

  1. Create a Kubernetes Secret (replace the value with your actual key, base64-encoded):
apiVersion: v1
kind: Secret
metadata:
  name: dify-secret-key
type: Opaque
data:
  SECRET_KEY: c2stZXhhbXBsZS1rZXktdGhhdC1pcy1iYXNlNjQtZW5jb2RlZA==

(You can generate the value with: echo -n 'your-secret-key' | base64)

  1. In your Deployment manifests for each backend component, inject the SECRET_KEY from the Secret:
env:
  - name: SECRET_KEY
    valueFrom:
      secretKeyRef:
        name: dify-secret-key
        key: SECRET_KEY

Make sure this is present in the env section for api, worker, worker_beat, and plugin_daemon pods. The frontend/web pods do not need SECRET_KEY for this purpose.

SECRET_KEY must be identical across all backend pods and should never change if you have existing encrypted data, or you’ll lose access to that data. If you’re using a community Helm chart or YAML, check that it supports injecting custom secrets—otherwise, you may need to adapt it.

Let me know if you want a full example for Helm, Kustomize, or plain YAML, or if you have questions about secret management in Kubernetes.

To reply, just mention @dosu.


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

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 19, 2025): <!-- Answer --> You should store SECRET_KEY as a Kubernetes Secret and inject it into all Dify backend pods that handle encryption/decryption (api, worker, worker_beat, plugin_daemon). Here’s a typical approach: 1. Create a Kubernetes Secret (replace the value with your actual key, base64-encoded): ```yaml apiVersion: v1 kind: Secret metadata: name: dify-secret-key type: Opaque data: SECRET_KEY: c2stZXhhbXBsZS1rZXktdGhhdC1pcy1iYXNlNjQtZW5jb2RlZA== ``` (You can generate the value with: `echo -n 'your-secret-key' | base64`) 2. In your Deployment manifests for each backend component, inject the SECRET_KEY from the Secret: ```yaml env: - name: SECRET_KEY valueFrom: secretKeyRef: name: dify-secret-key key: SECRET_KEY ``` Make sure this is present in the env section for api, worker, worker_beat, and plugin_daemon pods. The frontend/web pods do not need SECRET_KEY for this purpose. SECRET_KEY must be identical across all backend pods and should never change if you have existing encrypted data, or you’ll lose access to that data. If you’re using a community Helm chart or YAML, check that it supports injecting custom secrets—otherwise, you may need to adapt it. Let me know if you want a full example for Helm, Kustomize, or plain YAML, or if you have questions about secret management in Kubernetes. <!-- 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/353f84da-31e9-430e-a33b-58a07e0c14ff?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/353f84da-31e9-430e-a33b-58a07e0c14ff?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/353f84da-31e9-430e-a33b-58a07e0c14ff?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/353f84da-31e9-430e-a33b-58a07e0c14ff?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/353f84da-31e9-430e-a33b-58a07e0c14ff?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/353f84da-31e9-430e-a33b-58a07e0c14ff?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/353f84da-31e9-430e-a33b-58a07e0c14ff?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=You%20should%20store%20SECRET_KEY%20as%20a%20Kubernetes%20Secret%20and%20inject%20it%20into%20all%20Dify%20backend%20pods%20that%20handle%20encryption/decryption%20%28api%2C%20worker%2C%20worker_beat%2C%20plugin_daemon%29.%20Here%E2%80%99s%20a%20typical%20approach%3A%0A%0A1.%20Create%20a%20Kubernetes%20Secret%20%28replace%20the%20value%20with%20your%20actual%20key%2C%20base64-encoded%29%3A%0A%0A%60%60%60yaml%0AapiVersion%3A%20v1%0Akind%3A%20Secret%0Ametadata%3A%0A%20%20name%3A%20dify-secret-key%0Atype%3A%20Opaque%0Adata%3A%0A%20%20SECRET_KEY%3A%20c2stZXhhbXBsZS1rZXktdGhhdC1pcy1iYXNlNjQtZW5jb2RlZA%3D%3D%0A%60%60%60%0A%28You%20can%20generate%20the%20value%20with%3A%20%60echo%20-n%20%27your-secret-key%27%20%7C%20base64%60%29%0A%0A2.%20In%20your%20Deployment%20manifests%20for%20each%20backend%20component%2C%20inject%20the%20SECRET_KEY%20from%20the%20Secret%3A%0A%0A%60%60%60yaml%0Aenv%3A%0A%20%20-%20name%3A%20SECRET_KEY%0A%20%20%20%20valueFrom%3A%0A%20%20%20%20%20%20secretKeyRef%3A%0A%20%20%20%20%20%20%20%20name%3A%20dify-secret-key%0A%20%20%20%20%20%20%20%20key%3A%20SECRET_KEY%0A%60%60%60%0A%0AMake%20sure%20this%20is%20present%20in%20the%20env%20section%20for%20api%2C%20worker%2C%20worker_beat%2C%20and%20plugin_daemon%20pods.%20The%20frontend/web%20pods%20do%20not%20need%20SECRET_KEY%20for%20this%20purpose.%0A%0ASECRET_KEY%20must%20be%20identical%20across%20all%20backend%20pods%20and%20should%20never%20change%20if%20you%20have%20existing%20encrypted%20data%2C%20or%20you%E2%80%99ll%20lose%20access%20to%20that%20data.%20If%20you%E2%80%99re%20using%20a%20community%20Helm%20chart%20or%20YAML%2C%20check%20that%20it%20supports%20injecting%20custom%20secrets%E2%80%94otherwise%2C%20you%20may%20need%20to%20adapt%20it.%0A%0ALet%20me%20know%20if%20you%20want%20a%20full%20example%20for%20Helm%2C%20Kustomize%2C%20or%20plain%20YAML%2C%20or%20if%20you%20have%20questions%20about%20secret%20management%20in%20Kubernetes.)&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-official-plugins/issues/2288)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#883