【发布时间】:2017-09-14 15:57:17
【问题描述】:
我已完成文档中的所有步骤,通过电子邮件/密码组合进行注册的用户池(工作),在身份池和身份提供者的用户池部分中配置了 FB 身份提供者,并实现了以下代码在此处找到示例http://docs.aws.amazon.com/cognito/latest/developerguide/facebook.html,并在下面使用我的身份池进行了修改。
{代码}
function facebookLogin(){
FB.login(function (response) {
// Check if the user logged in successfully.
if (response.authResponse) {
console.log('You are now logged in.' + response.authResponse.accessToken);
// Add the Facebook access token to the Cognito credentials login map.
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-east-1:eb997110-50b3-4e40-97ff-fbaf796da9ef',
Logins: {
'graph.facebook.com': response.authResponse.accessToken // cognitouser.idToken
}
});
console.log('Added FB access token to Cognito.');
// Obtain AWS credentials
AWS.config.credentials.get(function(){
//getCurrentUser();
console.log('Got the aws creds.');
});
} else {
console.log('There was a problem logging you in.');
}
});
}
{代码}
我可以逐步检查并看到 FB 令牌被传递到 CognitoIdentityCredentials 并且没有错误,但用户从未在我的身份池或用户池中注册。
我错过了什么吗?
【问题讨论】:
-
我现在遇到了同样的问题。有人有解决方案吗?谢谢。
-
我从来没有得到它,最终为 FB 和 Google 做了一个自定义解决方案。
标签: facebook-javascript-sdk aws-sdk aws-cognito