Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(auth): clean signIn state after all relevant async works finish #14053

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export async function confirmSignIn(
});

if (AuthenticationResult) {
cleanActiveSignInState();
await cacheCognitoTokens({
username,
...AuthenticationResult,
Expand All @@ -121,6 +120,7 @@ export async function confirmSignIn(
}),
signInDetails,
});
cleanActiveSignInState();

await dispatchSignedInHubEvent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ export async function signInWithCustomAuth(
signInDetails,
});
if (AuthenticationResult) {
cleanActiveSignInState();

await cacheCognitoTokens({
username: activeUsername,
...AuthenticationResult,
Expand All @@ -97,6 +95,7 @@ export async function signInWithCustomAuth(
}),
signInDetails,
});
cleanActiveSignInState();

await dispatchSignedInHubEvent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export async function signInWithSRP(
signInDetails,
});
if (AuthenticationResult) {
cleanActiveSignInState();
await cacheCognitoTokens({
username: activeUsername,
...AuthenticationResult,
Expand All @@ -103,6 +102,7 @@ export async function signInWithSRP(
}),
signInDetails,
});
cleanActiveSignInState();

await dispatchSignedInHubEvent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export async function signInWithUserAuth(
});

if (response.AuthenticationResult) {
cleanActiveSignInState();
await cacheCognitoTokens({
username: activeUsername,
...response.AuthenticationResult,
Expand All @@ -112,6 +111,8 @@ export async function signInWithUserAuth(
}),
signInDetails,
});
cleanActiveSignInState();

await dispatchSignedInHubEvent();

resetAutoSignIn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export async function signInWithUserPassword(
signInDetails,
});
if (AuthenticationResult) {
cleanActiveSignInState();
await cacheCognitoTokens({
...AuthenticationResult,
username: activeUsername,
Expand All @@ -98,6 +97,7 @@ export async function signInWithUserPassword(
}),
signInDetails,
});
cleanActiveSignInState();

await dispatchSignedInHubEvent();

Expand Down
Loading