我已經按照文檔中的所有步驟操作,通過電子郵件/密碼組合(工作)註冊用戶池,在身份池和用戶池中配置了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