Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: resolve double encryption of integration config on token refresh

DarkPhoenix27048e719674023d
diff --git a/packages/nocodb/src/models/Integration.ts b/packages/nocodb/src/models/Integration.ts
index 9253b83870..796366815f 100644
--- a/packages/nocodb/src/models/Integration.ts
+++ b/packages/nocodb/src/models/Integration.ts
@@ -195,11 +195,6 @@ export default class Integration implements IntegrationType {
]);
if (updateObj.config) {
- updateObj.config = encryptPropIfRequired({
- data: updateObj,
- });
- updateObj.is_encrypted = isEncryptionRequired();
-
this.encryptConfigIfRequired(updateObj);
}
@@ -626,7 +621,9 @@ export default class Integration implements IntegrationType {
getIntegrationWrapper<T = any>(pLogger?: (message: string) => void) {
if (!this.wrapper) {
- const integrationWrapper = Integration.availableIntegrations.find(
+ const IntegrationClass = this.constructor as typeof Integration;
+
+ const integrationWrapper = IntegrationClass.availableIntegrations.find(
(el) => el.type === this.type && el.sub_type === this.sub_type,
);
@@ -637,7 +634,7 @@ export default class Integration implements IntegrationType {
this.wrapper = new integrationWrapper.wrapper(this.getConfig(), {
saveConfig: async (config: any) => {
- await Integration.updateIntegration(
+ await IntegrationClass.updateIntegration(
{
workspace_id: this.fk_workspace_id,
},
@@ -655,7 +652,7 @@ export default class Integration implements IntegrationType {
) {
(this.wrapper as any).setTokenRefreshCallback(
async (tokens: { oauth_token: string; refresh_token?: string }) => {
- await Integration.updateIntegration(
+ await IntegrationClass.updateIntegration(
{ workspace_id: this.fk_workspace_id },
this.id,
{