Skip to content

Commit

Permalink
Revert: Apple sign-in (#7348)
Browse files Browse the repository at this point in the history
* Revert "feat: Support for Apple Sign In (#7265)"
  • Loading branch information
ammarkarachi authored May 18, 2021
1 parent 188efdd commit 6bc5bc5
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 626 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -589,27 +589,16 @@ Resources:
- ' let providerCredsIndex = hostedUIProviderCreds.findIndex((provider) => provider.ProviderName === providerName);'
- ' let providerCreds = hostedUIProviderCreds[providerCredsIndex];'
- ' let requestParams = {'
- ' ProviderDetails: {'
- ' ''client_id'': providerCreds.client_id,'
- ' ''client_secret'': providerCreds.client_secret,'
- ' ''authorize_scopes'': providerMeta.authorize_scopes'
- ' },'
- ' ProviderName: providerMeta.ProviderName,'
- ' UserPoolId: userPoolId,'
- ' AttributeMapping: providerMeta.AttributeMapping,'
- ' AttributeMapping: providerMeta.AttributeMapping'
- ' };'
- ' let providerDetails;'
- ' if (providerMeta.ProviderName === ''SignInWithApple'') {'
- ' 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 {'
- ' providerDetails = {'
- ' ''client_id'': providerCreds.client_id,'
- ' ''client_secret'': providerCreds.client_secret,'
- ' ''authorize_scopes'': providerMeta.authorize_scopes,'
- ' };'
- ' }'
- ' return { ProviderDetails: providerDetails, ...requestParams };'
- ' return requestParams;'
- ' };'
- ' let createIdentityProvider = (providerName) => {'
- ' let requestParams = getRequestParams(providerName);'
Expand Down Expand Up @@ -1123,9 +1112,6 @@ Resources:
<%if (props.authProviders.indexOf('www.amazon.com') !== -1) { %>
www.amazon.com: !Ref amazonAppId
<% } %>
<%if (props.authProviders.indexOf('appleid.apple.com') !== -1) { %>
appleid.apple.com: !Ref appleAppId
<% } %>
<% } %>
AllowUnauthenticatedIdentities: !Ref allowUnauthenticatedIdentities
<%if (props.audiences && props.audiences.length > 0) { %>
Expand Down Expand Up @@ -1208,8 +1194,4 @@ Outputs :
AmazonWebClient:
Value: !Ref amazonAppId
<% } %>
<%if (props.appleAppId) { %>
AppleWebClient:
Value: !Ref appleAppId
<% } %>
<% } %>
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ const attributeProviderMap = {
facebook: {},
google: {},
loginwithamazon: {},
signinwithapple: {},
},
birthdate: {
facebook: {
Expand All @@ -148,7 +147,6 @@ const attributeProviderMap = {
scope: 'profile',
},
loginwithamazon: {},
signinwithapple: {},
},
email: {
facebook: {
Expand All @@ -163,10 +161,6 @@ const attributeProviderMap = {
attr: 'email',
scope: 'profile',
},
signinwithapple: {
attr: 'email',
scope: 'email',
},
},
family_name: {
facebook: {
Expand All @@ -178,10 +172,6 @@ const attributeProviderMap = {
scope: 'profile',
},
loginwithamazon: {},
signinwithapple: {
attr: 'lastName',
scope: 'name',
},
},
gender: {
facebook: {
Expand All @@ -193,7 +183,6 @@ const attributeProviderMap = {
scope: 'profile',
},
loginwithamazon: {},
signinwithapple: {},
},
given_name: {
facebook: {
Expand All @@ -205,10 +194,6 @@ const attributeProviderMap = {
scope: 'profile',
},
loginwithamazon: {},
signinwithapple: {
attr: 'firstName',
scope: 'name',
},
},
locale: {
facebook: {},
Expand All @@ -217,7 +202,6 @@ const attributeProviderMap = {
attr: 'postal_code',
scope: 'postal_code',
},
signinwithapple: {},
},
middle_name: {
facebook: {
Expand All @@ -226,7 +210,6 @@ const attributeProviderMap = {
},
google: {},
loginwithamazon: {},
signinwithapple: {},
},
name: {
facebook: {
Expand All @@ -241,13 +224,11 @@ const attributeProviderMap = {
attr: 'name',
scope: 'profile',
},
signinwithapple: {},
},
nickname: {
facebook: {},
google: {},
loginwithamazon: {},
signinwithapple: {},
},
phone_number: {
facebook: {},
Expand All @@ -256,7 +237,6 @@ const attributeProviderMap = {
scope: 'profile',
},
loginwithamazon: {},
signinwithapple: {},
},
picture: {
facebook: {
Expand All @@ -268,31 +248,26 @@ const attributeProviderMap = {
scope: 'profile',
},
loginwithamazon: {},
signinwithapple: {},
},
preferred_username: {
facebook: {},
google: {},
loginwithamazon: {},
signinwithapple: {},
},
profile: {
facebook: {},
google: {},
loginwithamazon: {},
signinwithapple: {},
},
zoneinfo: {
facebook: {},
google: {},
loginwithamazon: {},
signinwithapple: {},
},
website: {
facebook: {},
google: {},
loginwithamazon: {},
signinwithapple: {},
},
username: {
facebook: {
Expand All @@ -307,7 +282,6 @@ const attributeProviderMap = {
attr: 'user_id',
scope: 'profile:user_id',
},
signinwithapple: {},
},
updated_at: {
facebook: {
Expand All @@ -316,7 +290,6 @@ const attributeProviderMap = {
},
google: {},
loginwithamazon: {},
signinwithapple: {},
},
};

Expand Down Expand Up @@ -419,11 +392,6 @@ const authProviders = [
value: 'www.amazon.com',
answerHashKey: 'amazonAppId',
},
{
name: 'Apple',
value: 'appleid.apple.com',
answerHashKey: 'appleAppId',
},
];

const hostedUIProviders = [
Expand All @@ -439,10 +407,6 @@ const hostedUIProviders = [
name: 'Login With Amazon',
value: 'LoginWithAmazon',
},
{
name: 'Sign in with Apple',
value: 'SignInWithApple',
},
];

const authorizeScopes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ export const ENV_SPECIFIC_PARAMS = [
'amazonAppId',
'loginwithamazonAppIdUserPool',
'loginwithamazonAppSecretUserPool',
'signinwithappleClientIdUserPool',
'signinwithappleTeamIdUserPool',
'signinwithappleKeyIdUserPool',
'signinwithapplePrivateKeyUserPool',
'hostedUIProviderCreds',
];

Expand Down Expand Up @@ -59,10 +55,6 @@ export const privateKeys = [
'loginwithamazonAppIdUserPool',
'loginwithamazonAuthorizeScopes',
'loginwithamazonAppSecretUserPool',
'signinwithappleClientIdUserPool',
'signinwithappleTeamIdUserPool',
'signinwithappleKeyIdUserPool',
'signinwithapplePrivateKeyUserPool',
'CallbackURLs',
'LogoutURLs',
'AllowedOAuthFlows',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { importMessages } from './messages';
import uuid from 'uuid';

// Currently the CLI only supports the output generation of these providers
const supportedIdentityProviders = ['COGNITO', 'Facebook', 'Google', 'LoginWithAmazon', 'SignInWithApple'];
const supportedIdentityProviders = ['COGNITO', 'Facebook', 'Google', 'LoginWithAmazon'];

export const importResource = async (
context: $TSContext,
Expand Down Expand Up @@ -752,9 +752,6 @@ const createMetaOutput = (answers: ImportAnswers, hasOAuthConfig: boolean): Meta
case 'accounts.google.com':
output.GoogleWebClient = answers.identityPool!.SupportedLoginProviders![key];
break;
case 'appleid.apple.com':
output.AppleWebClient = answers.identityPool!.SupportedLoginProviders![key];
break;
default:
// We don't do anything with the providers that the CLI currently does not support.
break;
Expand Down Expand Up @@ -818,9 +815,6 @@ const createEnvSpecificResourceParameters = (
case 'graph.facebook.com':
envSpecificResourceParameters.facebookAppId = answers.identityPool!.SupportedLoginProviders![key];
break;
case 'appleid.apple.com':
envSpecificResourceParameters.appleAppId = answers.identityPool!.SupportedLoginProviders![key];
break;
case 'accounts.google.com': {
switch (projectType) {
case 'javascript':
Expand All @@ -846,23 +840,11 @@ const createEnvSpecificResourceParameters = (
};

const createOAuthCredentials = (identityProviders: IdentityProviderType[]): string => {
const credentials = identityProviders.map(idp => {
if (idp.ProviderName === 'SignInWithApple') {
return {
ProviderName: idp.ProviderName!,
client_id: idp.ProviderDetails!.client_id,
team_id: idp.ProviderDetails!.team_id,
key_id: idp.ProviderDetails!.key_id,
private_key: idp.ProviderDetails!.private_key,
};
} else {
return {
ProviderName: idp.ProviderName!,
client_id: idp.ProviderDetails!.client_id,
client_secret: idp.ProviderDetails!.client_secret,
};
}
});
const credentials = identityProviders.map(idp => ({
ProviderName: idp.ProviderName!,
client_id: idp.ProviderDetails!.client_id,
client_secret: idp.ProviderDetails!.client_secret,
}));

return JSON.stringify(credentials);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export type MetaOutput = {
AmazonWebClient?: string;
FacebookWebClient?: string;
GoogleWebClient?: string;
AppleWebClient?: string;
HostedUIDomain?: string;
OAuthMetadata?: string;
CreatedSNSRole?: string;
Expand All @@ -60,7 +59,6 @@ export type EnvSpecificResourceParameters = {
identityPoolName?: string;
facebookAppId?: string;
amazonAppId?: string;
appleAppId?: string;
googleIos?: string;
googleAndroid?: string;
googleClientId?: string;
Expand Down
Loading

0 comments on commit 6bc5bc5

Please sign in to comment.