放大联合登录不返回 Facebook 的电子邮件
Amplify Federated Sign In not returning Email for Facebook
我正在使用 AWS Amplify 添加社交签名。使用 google 我收到了用户的电子邮件,但它在 facebook 中丢失了。
这是我的代码:
federatedSignIn(provider: any): void {
switch (provider) {
case 'facebook':
console.log("Authenticating using Facebook");
Auth.federatedSignIn({ provider: CognitoHostedUIIdentityProvider.Facebook });
break;
case 'google':
console.log("Authenticating using Google");
Auth.federatedSignIn({ provider: CognitoHostedUIIdentityProvider.Google });
break;
}
}
这是“预注册”Lambda 视为事件的内容。
{
"version": "1",
"region": "us-east-1",
"userPoolId": "us-east-xxxxxx",
"userName": "Facebook_123456",
"callerContext": {
"awsSdkVersion": "aws-sdk-unknown-unknown",
"clientId": "123456abcd"
},
"triggerSource": "PreSignUp_ExternalProvider",
"request": {
"userAttributes": {
"email_verified": "false",
"cognito:email_alias": "",
"phone_number_verified": "false",
"cognito:phone_number_alias": ""
},
"validationData": {}
},
"response": {
"autoConfirmUser": false,
"autoVerifyEmail": false,
"autoVerifyPhone": false
}
}
用户池设置
属性映射
问题出在 <amplify-facebook-button>
,因为它使用身份池工作流而不是用户池工作流。使用 federatedSignIn()
创建自定义按钮有效。
<button slot="federated-buttons" (click)=customSignIn()>Facebook</button>
customSignIn(): void{
Auth.federatedSignIn({provider: CognitoHostedUIIdentityProvider.Facebook });
}
我正在使用 AWS Amplify 添加社交签名。使用 google 我收到了用户的电子邮件,但它在 facebook 中丢失了。
这是我的代码:
federatedSignIn(provider: any): void {
switch (provider) {
case 'facebook':
console.log("Authenticating using Facebook");
Auth.federatedSignIn({ provider: CognitoHostedUIIdentityProvider.Facebook });
break;
case 'google':
console.log("Authenticating using Google");
Auth.federatedSignIn({ provider: CognitoHostedUIIdentityProvider.Google });
break;
}
}
这是“预注册”Lambda 视为事件的内容。
{
"version": "1",
"region": "us-east-1",
"userPoolId": "us-east-xxxxxx",
"userName": "Facebook_123456",
"callerContext": {
"awsSdkVersion": "aws-sdk-unknown-unknown",
"clientId": "123456abcd"
},
"triggerSource": "PreSignUp_ExternalProvider",
"request": {
"userAttributes": {
"email_verified": "false",
"cognito:email_alias": "",
"phone_number_verified": "false",
"cognito:phone_number_alias": ""
},
"validationData": {}
},
"response": {
"autoConfirmUser": false,
"autoVerifyEmail": false,
"autoVerifyPhone": false
}
}
用户池设置
属性映射
问题出在 <amplify-facebook-button>
,因为它使用身份池工作流而不是用户池工作流。使用 federatedSignIn()
创建自定义按钮有效。
<button slot="federated-buttons" (click)=customSignIn()>Facebook</button>
customSignIn(): void{
Auth.federatedSignIn({provider: CognitoHostedUIIdentityProvider.Facebook });
}