Skip to content

Commit

Permalink
Revert "feat(auth): Enable resumable SignIn" (#13855)
Browse files Browse the repository at this point in the history
Revert "feat(auth): Enable resumable SignIn (#13483)"

This reverts commit f3421f1.
  • Loading branch information
joon-won authored Sep 26, 2024
1 parent bcc3cbc commit b26e719
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 577 deletions.
14 changes: 0 additions & 14 deletions .github/integ-config/integ-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -609,20 +609,6 @@ tests:
sample_name: [subdomains]
spec: subdomains
browser: [chrome]
- test_name: integ_next_custom_auth
desc: 'Sign-in with Custom Auth flow'
framework: next
category: auth
sample_name: [custom-auth]
spec: custom-auth
browser: *minimal_browser_list
- test_name: integ_next_auth_sign_in_with_sms_mfa
desc: 'Resumable sign in with SMS MFA flow'
framework: next
category: auth
sample_name: [mfa]
spec: sign-in-resumable-mfa
browser: [chrome]

# DISABLED Angular/Vue tests:
# TODO: delete tests or add custom ui logic to support them.
Expand Down
268 changes: 0 additions & 268 deletions packages/auth/__tests__/providers/cognito/signInResumable.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe('local sign-in state management tests', () => {

beforeEach(() => {
cognitoUserPoolsTokenProvider.setAuthConfig(authConfig);
signInStore.dispatch({ type: 'RESET_STATE' });
});

test('local state management should return state after signIn returns a ChallengeName', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,7 @@ jest.mock('@aws-amplify/core', () => {
getConfig: jest.fn(() => mockAuthConfigWithOAuth),
[ACTUAL_ADD_OAUTH_LISTENER]: jest.fn(),
},
ConsoleLogger: jest.fn().mockImplementation(() => {
return { warn: jest.fn() };
}),
syncSessionStorage: {
setItem: jest.fn((key, value) => {
window.sessionStorage.setItem(key, value);
}),
getItem: jest.fn((key: string) => {
return window.sessionStorage.getItem(key);
}),
removeItem: jest.fn((key: string) => {
window.sessionStorage.removeItem(key);
}),
},
ConsoleLogger: jest.fn(),
};
});

Expand Down
9 changes: 6 additions & 3 deletions packages/auth/src/providers/cognito/apis/confirmSignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
VerifySoftwareTokenException,
} from '../types/errors';
import { ConfirmSignInInput, ConfirmSignInOutput } from '../types';
import { setActiveSignInState, signInStore } from '../utils/signInStore';
import {
cleanActiveSignInState,
setActiveSignInState,
signInStore,
} from '../utils/signInStore';
import { AuthError } from '../../../errors/AuthError';
import {
getNewDeviceMetadata,
Expand Down Expand Up @@ -105,8 +109,7 @@ export async function confirmSignIn(
});

if (AuthenticationResult) {
signInStore.dispatch({ type: 'RESET_STATE' });

cleanActiveSignInState();
await cacheCognitoTokens({
username,
...AuthenticationResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import {
SignInWithCustomAuthInput,
SignInWithCustomAuthOutput,
} from '../types';
import { setActiveSignInState, signInStore } from '../utils/signInStore';
import {
cleanActiveSignInState,
setActiveSignInState,
} from '../utils/signInStore';
import { cacheCognitoTokens } from '../tokenProvider/cacheTokens';
import {
ChallengeName,
Expand Down Expand Up @@ -81,7 +84,7 @@ export async function signInWithCustomAuth(
signInDetails,
});
if (AuthenticationResult) {
signInStore.dispatch({ type: 'RESET_STATE' });
cleanActiveSignInState();

await cacheCognitoTokens({
username: activeUsername,
Expand All @@ -108,7 +111,7 @@ export async function signInWithCustomAuth(
challengeParameters: retiredChallengeParameters as ChallengeParameters,
});
} catch (error) {
signInStore.dispatch({ type: 'RESET_STATE' });
cleanActiveSignInState();
assertServiceError(error);
const result = getSignInResultFromError(error.name);
if (result) return result;
Expand Down
Loading

0 comments on commit b26e719

Please sign in to comment.