我已经按照文档中的所有步骤操作,通过电子邮件/密码组合(工作)注册用户池,在身份池和用户池中配置了FB身份提供程序部分为身份提供者,并且实现了以下代码示例http://docs.aws.amazon.com/cognito/latest/developerguide/facebook.html,并在下面使用我的身份池对其进行了修改。如何使用Facebook令牌创建Cognito身份
{代码}
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并没有错误,但用户从来没有在任何我的身份池被注册或用户池。
我错过了什么吗?
我有此刻的同一问题的代码示例。任何人都有解决方案?谢谢。 – loveNZ
我从来没有得到过它,最终为FB和Google做了一个自定义解决方案。 – Michael