From e6236c044c83c59e7511ec39963d8c2c0d041b53 Mon Sep 17 00:00:00 2001 From: John Hockett Date: Tue, 7 Sep 2021 10:12:26 -0700 Subject: [PATCH] Revert "fix(amplify-category-auth): update attr mapping... (#7979)" This reverts commit 94d2491ca8b41c1673cca0dd7bf96ac1c3f2db69. --- .../auth-template.yml.ejs | 24 +++++++++++++------ .../awscloudformation/assets/string-maps.js | 5 +--- .../service-walkthroughs/auth-questions.js | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/amplify-category-auth/resources/cloudformation-templates/auth-template.yml.ejs b/packages/amplify-category-auth/resources/cloudformation-templates/auth-template.yml.ejs index 40294f64fb2..2b0e184271c 100644 --- a/packages/amplify-category-auth/resources/cloudformation-templates/auth-template.yml.ejs +++ b/packages/amplify-category-auth/resources/cloudformation-templates/auth-template.yml.ejs @@ -601,13 +601,17 @@ Resources: - ' AttributeMapping: providerMeta.AttributeMapping,' - ' };' - ' if (providerMeta.ProviderName === ''SignInWithApple'') {' - - ' requestParams.ProviderDetails = {' - - ' ''client_id'': providerCreds.client_id,' - - ' ''team_id'': providerCreds.team_id,' - - ' ''key_id'': providerCreds.key_id,' - - ' ''private_key'': providerCreds.private_key ? providerCreds.private_key : null,' - - ' ''authorize_scopes'': providerMeta.authorize_scopes,' - - ' };' + - ' if (providerCreds.client_id && providerCreds.team_id && providerCreds.key_id && providerCreds.private_key) {' + - ' requestParams.ProviderDetails = {' + - ' ''client_id'': providerCreds.client_id,' + - ' ''team_id'': providerCreds.team_id,' + - ' ''key_id'': providerCreds.key_id,' + - ' ''private_key'': providerCreds.private_key,' + - ' ''authorize_scopes'': providerMeta.authorize_scopes,' + - ' };' + - ' } else {' + - ' requestParams = null;' + - ' }' - ' } else {' - ' requestParams.ProviderDetails = {' - ' ''client_id'': providerCreds.client_id,' @@ -619,11 +623,17 @@ Resources: - ' };' - ' let createIdentityProvider = (providerName) => {' - ' let requestParams = getRequestParams(providerName);' + - ' if (!requestParams) {' + - ' return Promise.resolve();' + - ' }' - ' requestParams.ProviderType = requestParams.ProviderName;' - ' return identity.createIdentityProvider(requestParams).promise();' - ' };' - ' let updateIdentityProvider = (providerName) => {' - ' let requestParams = getRequestParams(providerName);' + - ' if (!requestParams) {' + - ' return Promise.resolve();' + - ' }' - ' return identity.updateIdentityProvider(requestParams).promise();' - ' };' - ' let deleteIdentityProvider = (providerName) => {' diff --git a/packages/amplify-category-auth/src/provider-utils/awscloudformation/assets/string-maps.js b/packages/amplify-category-auth/src/provider-utils/awscloudformation/assets/string-maps.js index fdd5eb51690..87a4cde193a 100644 --- a/packages/amplify-category-auth/src/provider-utils/awscloudformation/assets/string-maps.js +++ b/packages/amplify-category-auth/src/provider-utils/awscloudformation/assets/string-maps.js @@ -241,10 +241,7 @@ const attributeProviderMap = { attr: 'name', scope: 'profile', }, - signinwithapple: { - attr: 'name', - scope: 'name', - }, + signinwithapple: {}, }, nickname: { facebook: {}, diff --git a/packages/amplify-category-auth/src/provider-utils/awscloudformation/service-walkthroughs/auth-questions.js b/packages/amplify-category-auth/src/provider-utils/awscloudformation/service-walkthroughs/auth-questions.js index 617c7690634..b71b3bebf3d 100644 --- a/packages/amplify-category-auth/src/provider-utils/awscloudformation/service-walkthroughs/auth-questions.js +++ b/packages/amplify-category-auth/src/provider-utils/awscloudformation/service-walkthroughs/auth-questions.js @@ -425,7 +425,7 @@ function userPoolProviders(oAuthProviders, coreAnswers, prevAnswers) { res.hostedUIProviderMeta = JSON.stringify( oAuthProviders.map(el => { const lowerCaseEl = el.toLowerCase(); - const delimmiter = el === 'Facebook' ? ',' : ' '; + const delimmiter = el === 'Facebook' || el === 'SignInWithApple' ? ',' : ' '; const scopes = []; const maps = {}; attributesForMapping.forEach(a => {