问题描述
我创建了一个用户池 &身份池.
I have created one user pool & identity pool.
我使用过 javascript sdk.
I have used javascript sdk.
我可以注册,发送确认码 &使用 javascript sdk 成功确认用户.
I am able to signup, send confirmation code & confirm user successfully with javascript sdk.
但是当我尝试使用身份验证方法登录用户时尝试通过使用以下代码传递 idToken 来获取带有CognitoIdentityCredentials"的凭据
But when i try to sign in user with authenticate method & try to get credentials with "CognitoIdentityCredentials" by passing idToken with below code
logins[cognitoEndpoint + "/" + userPoolId] = jwtToken;
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: identityPoolId,
Logins: logins
});
它给了我以下错误
Error: Invalid identity pool configuration. Check assigned IAM roles for this pool.
at Request.extractError (aws-sdk.js:104063)
at Request.callListeners (aws-sdk.js:106060)
at Request.emit (aws-sdk.js:106034)
at Request.emit (aws-sdk.js:105121)
at Request.transition (aws-sdk.js:104843)
at AcceptorStateMachine.runTo (aws-sdk.js:108480)
at aws-sdk.js:108492
at Request.<anonymous> (aws-sdk.js:104859)
at Request.<anonymous> (aws-sdk.js:105123)
at Request.callListeners (aws-sdk.js:106070)
我已授予管理员访问未经身份验证的角色"的权限 &身份池的未经身份验证的角色"以及我正在使用其凭据的用户.
I have given administrator access to "Unauthenticated role" & "Unauthenticated role" of identity pool and to user whose credentials i am using.
我是 aws 的新手.谁能告诉我我错过了什么?
I am new to aws. Can anyone tell me what am i missing?
任何帮助将不胜感激.
推荐答案
检查您在 Cognito Identity Pools (Federated Identities) 中分配的角色是否与身份池具有信任关系.
Check that the role you have assigned in Cognito Identity Pools (Federated Identities), has a trust relationship with the identity pool.
获取身份池 ID + 无效角色的名称.为此:
- 转到 Cognito
- 选择管理联合身份
- 选择身份池
- 点击编辑身份池(右上角)
- 记下身份池 ID
- 记下不起作用的角色的名称(例如 Cognito_blahUnauth_Role
在 IAM 中,检查角色的信任关系.确保 StringEquals 条件值与身份池 ID 匹配.
In IAM, check the trust relationship for the role. Ensure that the StringEquals condition value matches the identity pool ID.
要做到这一点:
- 转到 IAM
- 点击角色
- 点击您之前记下的角色名称
- 点击信任关系
- 在右侧的条件下,检查 StringEquals 条件是否包含您之前记下的身份池 ID.
编辑要修复的信任关系.
这篇关于AWS:身份池配置无效.检查为此池分配的 IAM 角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!