diff --git a/packages/web/src/components/AddAppConnection/index.jsx b/packages/web/src/components/AddAppConnection/index.jsx
index c1c47743..2d1b468c 100644
--- a/packages/web/src/components/AddAppConnection/index.jsx
+++ b/packages/web/src/components/AddAppConnection/index.jsx
@@ -31,7 +31,7 @@ function AddAppConnection(props) {
const hasConnection = Boolean(connectionId);
const useShared = searchParams.get('shared') === 'true';
const appAuthClientId = searchParams.get('appAuthClientId') || undefined;
- const { authenticate, isPopupBlocked } = useAuthenticateApp({
+ const { authenticate } = useAuthenticateApp({
appKey: key,
connectionId,
appAuthClientId,
@@ -134,12 +134,6 @@ function AddAppConnection(props) {
)}
- {isPopupBlocked && (
-
- {formatMessage('addAppConnection.popupReminder')}
-
- )}
-
{error && (
{
@@ -37,6 +38,7 @@ export default function useAuthenticateApp(payload) {
return async function authenticate(payload = {}) {
const { fields } = payload;
setAuthenticationInProgress(true);
+
const response = {
key: appKey,
appAuthClientId: appAuthClientId || payload.appAuthClientId,
@@ -50,17 +52,18 @@ export default function useAuthenticateApp(payload) {
while (stepIndex < steps?.length) {
const step = steps[stepIndex];
const variables = computeAuthStepVariables(step.arguments, response);
- let popup;
-
- if (step.type === 'openWithPopup') {
- popup = processOpenWithPopup(variables.url);
-
- if (!popup) {
- setPopupBlocked(true);
- }
- }
try {
+ let popup;
+
+ if (step.type === 'openWithPopup') {
+ popup = processOpenWithPopup(variables.url);
+
+ if (!popup) {
+ throw new Error(formatMessage('addAppConnection.popupReminder'));
+ }
+ }
+
if (step.type === 'mutation') {
const stepResponse = await processMutation(step.name, variables);
response[step.name] = stepResponse;
@@ -81,11 +84,10 @@ export default function useAuthenticateApp(payload) {
setAuthenticationInProgress(false);
}
};
- }, [steps, appKey, appAuthClientId, connectionId]);
+ }, [steps, appKey, appAuthClientId, connectionId, formatMessage]);
return {
authenticate,
- isPopupBlocked,
inProgress: authenticationInProgress,
};
}