调用GetCredentialsForIdentity操作时发生错误(ResourceNotFoundException):标识'ap-south-1:sadf' [英] An error occurred (ResourceNotFoundException) when calling the GetCredentialsForIdentity operation: Identity 'ap-south-1:sadf'

查看:49
本文介绍了调用GetCredentialsForIdentity操作时发生错误(ResourceNotFoundException):标识'ap-south-1:sadf'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用IdentityId和Logins调用GetCredentialsForIdentity时遇到ResourceNotFoundException

I am getting ResourceNotFoundException when I call GetCredentialsForIdentity using IdentityId and Logins

client_identify = boto3.client('cognito-identity', region_name=POOL_REGION)
logins = {}
logins[
    "cognito-idp." + POOL_REGION + ".amazonaws.com/" + USER_POOL
] = id_token;
print(logins, IDENTITY_POOL_ID)
res = client_identify.get_credentials_for_identity(
  IdentityId=IDENTITY_POOL_ID,
  Logins=logins
)

我到达这里的错误是:botocore.errorfactory.ResourceNotFoundException:发生错误(ResourceNotFoundException)调用GetCredentialsForIdentity操作时:Identity在此处输入代码'ap-south-1:asdfadsfasdfsdafdsadfasdfasd'

Error I am getting here is: botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the GetCredentialsForIdentity operation: Identity enter code here'ap-south-1:asdfadsfasdfsdafdsadfasdfasd'

当我尝试使用javascript时,它的工作原理绝对不错.

When I try to do with javascript it's working absolutely fine.

python中有什么解决方案吗?

Is there any solution in python?

推荐答案

IDENTITY_POOL_ID IDENTITY_ID 是两个不同的东西.基本上需要使用get_id IDENTITY_POOL_ID 获取 IDENTITY_ID .

IDENTITY_POOL_ID and IDENTITY_ID are two different things. Basically need to use get_id to obtain IDENTITY_ID from IDENTITY_POOL_ID.

这是我测试正常运行的代码:

Here is the code which I tested to be working:

import boto3  
                                                                                          
                                                
client_identify = boto3.client('cognito-identity')   
                                                  
IDENTITY_POOL_ID = 'us-east-1:xxxxx-3f18-41f9-b4a6-xxxxx' 


response = client_identify.get_id(
         IdentityPoolId=IDENTITY_POOL_ID
)  

print(response)


IDENTITY_ID = response['IdentityId']                                                                      

print(IDENTITY_ID)                             

res = client_identify.get_credentials_for_identity(
       IdentityId=IDENTITY_ID
)

print(res)   

您需要根据需要进行调整.

You need to adjust it to your requirements.

这篇关于调用GetCredentialsForIdentity操作时发生错误(ResourceNotFoundException):标识'ap-south-1:sadf'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆