From 9f12035aa63f1eaa303e9d02c8c008c5e441ff7a Mon Sep 17 00:00:00 2001 From: Hui Zhao Date: Thu, 14 Sep 2023 15:04:24 -0700 Subject: [PATCH] fix(auth): signInWithRedirect urlListner attaches for non-browser env --- packages/auth/src/providers/cognito/apis/signInWithRedirect.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/auth/src/providers/cognito/apis/signInWithRedirect.ts b/packages/auth/src/providers/cognito/apis/signInWithRedirect.ts index 2d8bae03995..d77d54bbfc5 100644 --- a/packages/auth/src/providers/cognito/apis/signInWithRedirect.ts +++ b/packages/auth/src/providers/cognito/apis/signInWithRedirect.ts @@ -7,6 +7,7 @@ import { assertOAuthConfig, assertTokenProviderConfig, getAmplifyUserAgent, + isBrowser, urlSafeEncode, USER_AGENT_HEADER, } from '@aws-amplify/core/internals/utils'; @@ -391,7 +392,7 @@ function urlListener() { }); } -urlListener(); +isBrowser() && urlListener(); // This has a reference for listeners that requires to be notified, TokenOrchestrator use this for load tokens let resolveInflightPromise = () => {};