我怎么能得到UserPool细节通过IdentityPool/UserPool id(子)

0

的问题

有没有办法获得的用户的详细信息(profile属性等)如果我有IdentityPool或UserPool ID(子)用户传输?

使用的情况是,我是节省一些提交信息的用户数据库与的一个关键平等的用户标识(子). 所以,当我读它从数据库中,我想要恢复一些用户信息从我的泳池我的应用程序的用户界面。

我发现了一个类似的问题(得到cognito用户池用户名从cognito身份池identityId),但它看来,给出的答案是围绕着无服务器的部署,仍有一些差距。

在此先感谢

amazon-cognito aws-sdk aws-sdk-js
2021-11-22 01:56:13
2

最好的答案

1

因为你有用户的 sub你可以使用 AdminGetUser. 它返回 UserAttributes 在游泳池。

2021-11-24 06:05:46
0

我想我找到一个解决方案,它是在表面上实际。

具有用户池id一个可以使用 ListUsers 呼叫滤 sub = \"${userId}\". 客户使用 CognitoIdentityProviderClient如果JS是使用。

    const client = new CognitoIdentityProviderClient({
        region: REGION,
        credentials: fromCognitoIdentityPool({
            client: new CognitoIdentityClient({ region: REGION }),
            logins: {
                [PROVIDER_ID]: token
            },
            identityPoolId: ID_POOL_ID
        })
    });

    const filter = `sub = \"${userPoolId}\"`;

    const resp = await client.send(new ListUsersCommand({
        UserPoolId: USER_POOL_ID,
        Filter: filter,
        Limit: 1
    }));

当然AdminGetUser可以使用,作为乌拉长沙雷凯莱斯上所述,如果它是适用

2021-11-24 13:50:51

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................