登录的cognito用户不会显示在身份池中

问题描述 投票:1回答:1

用户注册并验证其帐户。然后用户登录:

// in real life, these fields are replaced with my values
var cognitoUser = userPool.getCurrentUser();

if (cognitoUser != null) {
    cognitoUser.getSession(function(err, result) {
        if (result) {
            console.log('You are now logged in.');

            // Add the User's Id Token to the Cognito credentials login map.
            AWS.config.credentials = new AWS.CognitoIdentityCredentials({
                IdentityPoolId: 'YOUR_IDENTITY_POOL_ID',
                Logins: {
                    'cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>': result.getIdToken().getJwtToken()
                }
            });
        }
    });
}

http://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-integrating-user-pools-with-identity-pools.html

因此,登录用户因此被认证并允许使用Web应用程序内的各种页面。

但是,在此期间,零用户出现在身份池enter image description here

这些注册/登录的用户是否应该出现在这里?或者,我是否误解了身份库的重点?

amazon-web-services amazon-cognito
1个回答
1
投票

你的直觉是正确的,我只是认为你的身份池的调用没有成功。我的猜测是你正在创建这些凭据,但实际上并没有填充它们。您可以尝试在该对象上调用get或refresh,然后再次检查吗?

© www.soinside.com 2019 - 2024. All rights reserved.