用户池不存在

问题描述 投票:0回答:5

我尝试从 java 后端连接到 aws cognito,但是当在 AWS Lambda 中测试它时,它向我抛出异常并显示以下消息:

"errorMessage": "User pool XXXXX does not exist. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: ResourceNotFoundException; Request ID: -------------)"

我输入的凭据是正确的,因为我已经在 python 代码中测试了它们并且它工作正常。

这是我建立连接的代码:

private AdminInitiateAuthRequest buildAuhtRequest(String email, String password){
    Map<String,String> authParams = new HashMap<String,String>();
    authParams.put("email", email);
    authParams.put("password", password);

    return new AdminInitiateAuthRequest()
            .withAuthFlow(AuthFlowType.ADMIN_NO_SRP_AUTH)
            .withAuthParameters(authParams)
            .withClientId(credentials.getClientId())
            .withUserPoolId(credentials.getPoolId());
}

这是凭证类,尽管它非常简单:

public class CognitoClientCredentials {

    private String poolId = "xxxxxxxxx";
    private String clientId = "xxxxxxxxxxxxxxxx";

    public String getPoolId(){
        return this.poolId;
    }

    public String getClientId(){
        return this.clientId;
    }
}
java server-side amazon-cognito
5个回答
2
投票

此答案适用于可能遇到用户池相关错误的人。当我在 AWS Cognito 中将验证类型从“代码”更改为“链接”后,我开始出现此类错误。只需在我的用户池设置的“应用程序集成”选项卡中设置域名即可解决该问题。 该线程帮助我解决了我的问题 -> https://github.com/amazon-archives/amazon-cognito-identity-js/issues/512


1
投票

设置区域并尝试让您的函数识别在 cognito 下检查哪个区域。


1
投票

您可能在本地已经设置了具有默认区域、访问密钥和访问密钥的 aws 环境;虽然您的 lambda 角色无权处理您指定的 Cognito 池。尝试增加您的 lambda 角色的权限。


0
投票

我身上发生的事情是......

AWS.Config 从我的 Windows 10 用户帐户 (.aws/credentials) 获取了我的个人资料。

因此,我必须以编程方式修改 AWS.config.credentials


0
投票

我设置了多个 AWS 配置文件,因此我必须将默认配置文件更改为我想要连接且有效的 AWS 实例

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