AmazonCognitoIdentity AccessDeniedException

AmazonCognitoIdentity AccessDeniedException

我正在开发一个应用程序,我需要使用 Amazon Cognito 来访问 AS3 服务。

我创建了一个 IdentityPool,我有我的 IdentityPoolId,我创建了我的开发者提供者,所以我有我的开发者提供者名称。但是当我执行 getOpenIdTokenForDeveloperIdentity 时,响应为空:

(Service: AmazonCognitoIdentity; Status Code: 400; Error Code: AccessDeniedException;

    try{
     AmazonCognitoIdentity identityClient = new AmazonCognitoIdentityClient(
            new BasicAWSCredentials(accessKeyId, secretAccessKey)
          );
    GetOpenIdTokenForDeveloperIdentityRequest tokenRequest = new GetOpenIdTokenForDeveloperIdentityRequest();
    tokenRequest.setIdentityPoolId("us-east-1:xxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxx");
    HashMap<String, String> providerTokens = new HashMap<String, String>();
    providerTokens.put(<developer provider name>,<some identifier backend>);
    String token = result.getToken();
        System.out.println(token);
    }catch (Exception e) {
        System.out.println(e.getMessage());
    }

而且总是抓不到。

我只需将 AmazonCognitoDeveloperAuthenticatedIdentities 策略附加到与我连接到 Amazon 的用户即可。

amazon Identity and Access Management console

AccessDenied 在这种情况下表示 IAM user/role 上的策略不允许您尝试执行的操作。如果您有任何其他问题,请参阅我们的 developer guide or feel free to post on our forum.