Skip to content

Commit

Permalink
revert(auth): standalone enable oauth listener for MPAs (#12753)
Browse files Browse the repository at this point in the history
* Revert "fix(auth): oAuthStore is used before a valid OAuth config is confirmed (#12748)"

This reverts commit ae64386.

* Revert "feat(auth): standalone enable oauth listener for MPAs (#12731)"

This reverts commit 94d1fb2.
  • Loading branch information
AllanZhengYP authored Dec 26, 2023
1 parent ae64386 commit 0462761
Show file tree
Hide file tree
Showing 52 changed files with 683 additions and 1,470 deletions.
27 changes: 0 additions & 27 deletions packages/auth/__tests__/mockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,3 @@ export const transformedMockData = [
name: 'react-native',
},
];

export const mockAuthConfigWithOAuth = {
Auth: {
Cognito: {
identityPoolId: 'identityPoolId',
userPoolClientId: 'userPoolClientId',
userPoolId: 'userPoolId',
loginWith: {
username: true,
oauth: {
domain: 'oauth.domain.com',
scopes: [
'phone',
'email',
'openid',
'profile',
'aws.cognito.signin.user.admin',
],
redirectSignIn: ['http://localhost:3000/'],
redirectSignOut: ['http://localhost:3000/'],
responseType: 'code' as const,
providers: ['Google' as const],
},
},
},
},
};
7 changes: 1 addition & 6 deletions packages/auth/__tests__/providers/cognito/autoSignIn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ import { Amplify } from 'aws-amplify';
import * as initiateAuthHelpers from '../../../src/providers/cognito/utils/signInHelpers';
import { AuthError } from '../../../src/errors/AuthError';

jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));

const authConfig = {
Cognito: {
userPoolClientId: '111111-aaaaa-42d8-891d-ee81a1549398',
Expand All @@ -39,7 +34,7 @@ describe('Auto sign-in API Happy Path Cases:', () => {
signUpSpy = jest
.spyOn(signUpClient, 'signUp')
.mockImplementationOnce(
async () => ({ UserConfirmed: true }) as SignUpCommandOutput
async () => ({ UserConfirmed: true } as SignUpCommandOutput)
);

handleUserSRPAuthflowSpy = jest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
4 changes: 0 additions & 4 deletions packages/auth/__tests__/providers/cognito/deleteUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock('../../../src/providers/cognito/apis/signOut');
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { Auth: { getTokens: jest.fn() }, getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));

describe('getCurrentUser', () => {
const mockedSub = 'mockedSub';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
4 changes: 0 additions & 4 deletions packages/auth/__tests__/providers/cognito/setUpTOTP.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jest.mock('@aws-amplify/core', () => ({
...(jest.createMockFromModule('@aws-amplify/core') as object),
Amplify: { getConfig: jest.fn(() => ({})) },
}));
jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));
jest.mock('../../../src/providers/cognito/apis/getCurrentUser');
jest.mock(
'../../../src/providers/cognito/utils/clients/CognitoIdentityProvider'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ import {
} from '../../../src/providers/cognito/tokenProvider';
import * as clients from '../../../src/providers/cognito/utils/clients/CognitoIdentityProvider';

jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));

const authConfig = {
Cognito: {
userPoolClientId: '111111-aaaaa-42d8-891d-ee81a1549398',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ import {
} from '../../../src/providers/cognito/tokenProvider';
import * as clients from '../../../src/providers/cognito/utils/clients/CognitoIdentityProvider';

jest.mock('@aws-amplify/core/internals/utils', () => ({
...jest.requireActual('@aws-amplify/core/internals/utils'),
isBrowser: jest.fn(() => false),
}));

const authConfig = {
Cognito: {
userPoolClientId: '111111-aaaaa-42d8-891d-ee81a1549398',
Expand Down
Loading

0 comments on commit 0462761

Please sign in to comment.