Skip to content

Commit

Permalink
fix: Correctly generate Gen1 social provider config form Gen2 (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amplifiyer committed May 14, 2024
1 parent 508247a commit f7b8089
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-dancers-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/client-config': patch
---

Correctly generate Gen1 social provider config form Gen2
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ void describe('ClientConfigLegacyConverter', () => {
redirect_sign_in_uri: ['http://callback.com', 'http://callback2.com'],
redirect_sign_out_uri: ['http://logout.com', 'http://logout2.com'],
response_type: 'code',
identity_providers: ['GOOGLE', 'FACEBOOK'],
identity_providers: [
'GOOGLE',
'FACEBOOK',
'LOGIN_WITH_AMAZON',
'SIGN_IN_WITH_APPLE',
],
},
},
};
Expand Down Expand Up @@ -91,7 +96,7 @@ void describe('ClientConfigLegacyConverter', () => {
redirectSignOut: 'http://logout.com,http://logout2.com',
responseType: 'code',
},
aws_cognito_social_providers: ['GOOGLE', 'FACEBOOK'],
aws_cognito_social_providers: ['GOOGLE', 'FACEBOOK', 'AMAZON', 'APPLE'],
};

assert.deepStrictEqual(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@ export class ClientConfigLegacyConverter {
if (clientConfig.auth.oauth) {
authClientConfig.oauth = {};
authClientConfig.aws_cognito_social_providers =
clientConfig.auth.oauth.identity_providers;
clientConfig.auth.oauth.identity_providers.map((provider) => {
if (provider === 'SIGN_IN_WITH_APPLE') {
return 'APPLE';
}
if (provider === 'LOGIN_WITH_AMAZON') {
return 'AMAZON';
}
return provider;
});
authClientConfig.oauth.domain = clientConfig.auth.oauth.domain;
authClientConfig.oauth.scope = clientConfig.auth.oauth.scopes;
authClientConfig.oauth.redirectSignIn =
Expand Down

0 comments on commit f7b8089

Please sign in to comment.