Skip to content

Commit b26e719

Browse files
authored
Revert "feat(auth): Enable resumable SignIn" (#13855)
Revert "feat(auth): Enable resumable SignIn (#13483)" This reverts commit f3421f1.
1 parent bcc3cbc commit b26e719

18 files changed

+76
-577
lines changed

.github/integ-config/integ-all.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -609,20 +609,6 @@ tests:
609609
sample_name: [subdomains]
610610
spec: subdomains
611611
browser: [chrome]
612-
- test_name: integ_next_custom_auth
613-
desc: 'Sign-in with Custom Auth flow'
614-
framework: next
615-
category: auth
616-
sample_name: [custom-auth]
617-
spec: custom-auth
618-
browser: *minimal_browser_list
619-
- test_name: integ_next_auth_sign_in_with_sms_mfa
620-
desc: 'Resumable sign in with SMS MFA flow'
621-
framework: next
622-
category: auth
623-
sample_name: [mfa]
624-
spec: sign-in-resumable-mfa
625-
browser: [chrome]
626612

627613
# DISABLED Angular/Vue tests:
628614
# TODO: delete tests or add custom ui logic to support them.

packages/auth/__tests__/providers/cognito/signInResumable.test.ts

Lines changed: 0 additions & 268 deletions
This file was deleted.

packages/auth/__tests__/providers/cognito/signInStateManagement.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ describe('local sign-in state management tests', () => {
3030

3131
beforeEach(() => {
3232
cognitoUserPoolsTokenProvider.setAuthConfig(authConfig);
33-
signInStore.dispatch({ type: 'RESET_STATE' });
3433
});
3534

3635
test('local state management should return state after signIn returns a ChallengeName', async () => {

packages/auth/__tests__/providers/cognito/signInWithRedirect.test.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,7 @@ jest.mock('@aws-amplify/core', () => {
4242
getConfig: jest.fn(() => mockAuthConfigWithOAuth),
4343
[ACTUAL_ADD_OAUTH_LISTENER]: jest.fn(),
4444
},
45-
ConsoleLogger: jest.fn().mockImplementation(() => {
46-
return { warn: jest.fn() };
47-
}),
48-
syncSessionStorage: {
49-
setItem: jest.fn((key, value) => {
50-
window.sessionStorage.setItem(key, value);
51-
}),
52-
getItem: jest.fn((key: string) => {
53-
return window.sessionStorage.getItem(key);
54-
}),
55-
removeItem: jest.fn((key: string) => {
56-
window.sessionStorage.removeItem(key);
57-
}),
58-
},
45+
ConsoleLogger: jest.fn(),
5946
};
6047
});
6148

packages/auth/src/providers/cognito/apis/confirmSignIn.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import {
1010
VerifySoftwareTokenException,
1111
} from '../types/errors';
1212
import { ConfirmSignInInput, ConfirmSignInOutput } from '../types';
13-
import { setActiveSignInState, signInStore } from '../utils/signInStore';
13+
import {
14+
cleanActiveSignInState,
15+
setActiveSignInState,
16+
signInStore,
17+
} from '../utils/signInStore';
1418
import { AuthError } from '../../../errors/AuthError';
1519
import {
1620
getNewDeviceMetadata,
@@ -105,8 +109,7 @@ export async function confirmSignIn(
105109
});
106110

107111
if (AuthenticationResult) {
108-
signInStore.dispatch({ type: 'RESET_STATE' });
109-
112+
cleanActiveSignInState();
110113
await cacheCognitoTokens({
111114
username,
112115
...AuthenticationResult,

packages/auth/src/providers/cognito/apis/signInWithCustomAuth.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import {
2121
SignInWithCustomAuthInput,
2222
SignInWithCustomAuthOutput,
2323
} from '../types';
24-
import { setActiveSignInState, signInStore } from '../utils/signInStore';
24+
import {
25+
cleanActiveSignInState,
26+
setActiveSignInState,
27+
} from '../utils/signInStore';
2528
import { cacheCognitoTokens } from '../tokenProvider/cacheTokens';
2629
import {
2730
ChallengeName,
@@ -81,7 +84,7 @@ export async function signInWithCustomAuth(
8184
signInDetails,
8285
});
8386
if (AuthenticationResult) {
84-
signInStore.dispatch({ type: 'RESET_STATE' });
87+
cleanActiveSignInState();
8588

8689
await cacheCognitoTokens({
8790
username: activeUsername,
@@ -108,7 +111,7 @@ export async function signInWithCustomAuth(
108111
challengeParameters: retiredChallengeParameters as ChallengeParameters,
109112
});
110113
} catch (error) {
111-
signInStore.dispatch({ type: 'RESET_STATE' });
114+
cleanActiveSignInState();
112115
assertServiceError(error);
113116
const result = getSignInResultFromError(error.name);
114117
if (result) return result;

0 commit comments

Comments
 (0)