Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Fix OAuth button state updates after authentication

samme-abdulcc378953c714
diff --git a/packages/app/src/builder-ui/components/APICall.class.ts b/packages/app/src/builder-ui/components/APICall.class.ts
index 76832394..cf044007 100644
--- a/packages/app/src/builder-ui/components/APICall.class.ts
+++ b/packages/app/src/builder-ui/components/APICall.class.ts
@@ -867,7 +867,6 @@ export class APICall extends Component {
case 'oauth':
// console.log('Authentication was successful');
successToast(`${event.data.type} authentication was successful`);
-
// Clear auth check cache for the current connection after successful auth
if (this.data.oauth_con_id) {
this.authCheckPromises.delete(this.data.oauth_con_id);
@@ -892,10 +891,8 @@ export class APICall extends Component {
this.updateOAuthActionButton();
// Update authentication button state after sidebar refresh
await this.updateAuthenticationButtonState();
-
- // Update component's button state
- this.checkSettings();
});
+ this.checkSettings();
window.removeEventListener('message', this.boundHandleAuthMessage);
break;
@@ -908,6 +905,8 @@ export class APICall extends Component {
'alert',
);
}
+ this.checkSettings();
+ window.removeEventListener('message', this.boundHandleAuthMessage);
break;
default:
diff --git a/packages/app/src/builder-ui/helpers/oauth/oauth-settings.helper.ts b/packages/app/src/builder-ui/helpers/oauth/oauth-settings.helper.ts
index 664aff9f..355d1bcb 100644
--- a/packages/app/src/builder-ui/helpers/oauth/oauth-settings.helper.ts
+++ b/packages/app/src/builder-ui/helpers/oauth/oauth-settings.helper.ts
@@ -175,12 +175,12 @@ export class oAuthSettings {
*/
private async handleAuthSuccess(type: string): Promise<void> {
successToast(`${type} authentication was successful`);
+ this.component.checkSettings();
this.uiHelper?.updateSidebarForOAuth();
await this.updateOAuthConnectionOptions();
this.component.refreshSettingsSidebar();
this.uiHelper?.updateOAuthActionButtons(this.hasValidConnection());
await this.updateAuthenticationButtonState();
- this.component.checkSettings();
window.removeEventListener('message', this.boundHandleAuthMessage);
}