diff --git a/plugins/auth-node/src/oauth/createOAuthRouteHandlers.ts b/plugins/auth-node/src/oauth/createOAuthRouteHandlers.ts index fa6cb57e31..72640c8692 100644 --- a/plugins/auth-node/src/oauth/createOAuthRouteHandlers.ts +++ b/plugins/auth-node/src/oauth/createOAuthRouteHandlers.ts @@ -241,9 +241,11 @@ export function createOAuthRouteHandlers( ); } res.redirect(state.redirectUrl); + return; } + // post message back to popup if successful - return sendWebMessageResponse(res, appOrigin, { + sendWebMessageResponse(res, appOrigin, { type: 'authorization_response', response, }); @@ -252,7 +254,7 @@ export function createOAuthRouteHandlers( ? error : new Error('Encountered invalid error'); // Being a bit safe and not forwarding the bad value // post error message back to popup if failure - return sendWebMessageResponse(res, appOrigin, { + sendWebMessageResponse(res, appOrigin, { type: 'authorization_response', error: { name, message }, });