Skip to content
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 @@ -19,8 +19,41 @@ jest.mock('@aws-amplify/amplify-cli-core', () => ({
// mock fns
const pluginInstanceMock = jest.fn();
const loadResourceParametersMock = jest.fn().mockReturnValue({
hostedUIProviderMeta:
'[{"ProviderName":"Facebook","authorize_scopes":"email,public_profile","AttributeMapping":{"email":"email","username":"id"}},{"ProviderName":"LoginWithAmazon","authorize_scopes":"profile profile:user_id","AttributeMapping":{"email":"email","username":"user_id"}},{"ProviderName":"Google","authorize_scopes":"openid email profile","AttributeMapping":{"email":"email","username":"sub"}},{"ProviderName":"SignInWithApple","authorize_scopes":"openid email profile","AttributeMapping":{"email":"email","username":"sub"}}]',
thirdPartyAuth: true, // enable third party auth, but do not include any authProviders. Should not fail.
hostedUIProviderMeta: JSON.stringify([
{
ProviderName: 'Facebook',
authorize_scopes: 'email,public_profile',
AttributeMapping: {
email: 'email',
username: 'id',
},
},
{
ProviderName: 'LoginWithAmazon',
authorize_scopes: 'profile profile:user_id',
AttributeMapping: {
email: 'email',
username: 'user_id',
},
},
{
ProviderName: 'Google',
authorize_scopes: 'openid email profile',
AttributeMapping: {
email: 'email',
username: 'sub',
},
},
{
ProviderName: 'SignInWithApple',
authorize_scopes: 'openid email profile',
AttributeMapping: {
email: 'email',
username: 'sub',
},
},
]),
});
const pluginInstance = {
loadResourceParameters: loadResourceParametersMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@
const requiredParams: string[] = [];

if (previousValues.thirdPartyAuth) {
if (previousValues.authProviders.includes('accounts.google.com')) {
const authProviders = previousValues.authProviders ?? [];
if (authProviders.includes('accounts.google.com')) {
Comment thread Dismissed
requiredParams.push('googleClientId');
if (projectType === 'ios') {
requiredParams.push('googleIos');
Expand All @@ -335,14 +336,14 @@
requiredParams.push('googleAndroid');
}
}
if (previousValues.authProviders.includes('graph.facebook.com')) {
if (authProviders.includes('graph.facebook.com')) {
Comment thread Dismissed
requiredParams.push('facebookAppId');
}
if (previousValues.authProviders.includes('www.amazon.com')) {
if (authProviders.includes('www.amazon.com')) {
Comment thread Dismissed
requiredParams.push('amazonAppId');
}
// eslint-disable-next-line spellcheck/spell-checker
if (previousValues.authProviders.includes('appleid.apple.com')) {
if (authProviders.includes('appleid.apple.com')) {
Comment thread Dismissed
requiredParams.push('appleAppId');
}
}
Expand Down
Loading