From 3f2b87b044b7921884bdb23e475e4b10ba4eda83 Mon Sep 17 00:00:00 2001 From: Ayangade Adeoluwa <37867493+Irongade@users.noreply.github.com> Date: Thu, 31 Mar 2022 18:59:05 +0100 Subject: [PATCH] Fix issue with oauth2 save and authorize button (#12447) --- .../RestAPIDatasourceForm.tsx | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx index ae65943216..2e58701b40 100644 --- a/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx +++ b/app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx @@ -534,21 +534,29 @@ class DatasourceRestAPIEditor extends React.Component< {this.renderAuthFields()} {this.renderSelfSignedCertificateFields()} - - - this.save( - redirectAuthorizationCode(pageId, datasourceId, PluginType.API), - ) - } - size="small" - text={isAuthorized ? "Save and Re-Authorize" : "Save and Authorize"} - /> - + {formData.authType && formData.authType === AuthType.OAuth2 && ( + + + this.save( + redirectAuthorizationCode( + pageId, + datasourceId, + PluginType.API, + ), + ) + } + size="small" + text={ + isAuthorized ? "Save and Re-Authorize" : "Save and Authorize" + } + /> + + )} ); };