diff --git a/packages/auth/src/client/flows/userAuth/handleWebAuthnSignInResult.ts b/packages/auth/src/client/flows/userAuth/handleWebAuthnSignInResult.ts index 2e67a52a5ab..ee3bc6e6b6c 100644 --- a/packages/auth/src/client/flows/userAuth/handleWebAuthnSignInResult.ts +++ b/packages/auth/src/client/flows/userAuth/handleWebAuthnSignInResult.ts @@ -21,11 +21,7 @@ import { getNewDeviceMetadata, getSignInResult, } from '../../../providers/cognito/utils/signInHelpers'; -import { - cleanActiveSignInState, - setActiveSignInState, - signInStore, -} from '../../../client/utils/store'; +import { setActiveSignInState, signInStore } from '../../../client/utils/store'; import { AuthSignInOutput } from '../../../types'; import { getAuthUserAgentValue } from '../../../utils'; import { getPasskey } from '../../utils/passkey'; @@ -106,7 +102,7 @@ export async function handleWebAuthnSignInResult( }), signInDetails, }); - cleanActiveSignInState(); + signInStore.dispatch({ type: 'RESET_STATE' }); await dispatchSignedInHubEvent(); return { diff --git a/packages/auth/src/providers/cognito/apis/signInWithUserAuth.ts b/packages/auth/src/providers/cognito/apis/signInWithUserAuth.ts index 94165046864..77caf188ee7 100644 --- a/packages/auth/src/providers/cognito/apis/signInWithUserAuth.ts +++ b/packages/auth/src/providers/cognito/apis/signInWithUserAuth.ts @@ -28,8 +28,8 @@ import { } from '../types'; import { autoSignInStore, - cleanActiveSignInState, setActiveSignInState, + signInStore, } from '../../../client/utils/store'; import { cacheCognitoTokens } from '../tokenProvider/cacheTokens'; import { dispatchSignedInHubEvent } from '../utils/dispatchSignedInHubEvent'; @@ -111,7 +111,7 @@ export async function signInWithUserAuth( }), signInDetails, }); - cleanActiveSignInState(); + signInStore.dispatch({ type: 'RESET_STATE' }); await dispatchSignedInHubEvent(); @@ -132,7 +132,7 @@ export async function signInWithUserAuth( : undefined, }); } catch (error) { - cleanActiveSignInState(); + signInStore.dispatch({ type: 'RESET_STATE' }); resetAutoSignIn(); assertServiceError(error); const result = getSignInResultFromError(error.name);