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

Revert "feat(auth): Enable resumable SignIn" #13855

Merged
merged 1 commit into from
Sep 26, 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
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
Loading