相关疑难解决方法(0)

boto3 我如何认知身份验证

今天我想与 AWS Cognito 集成。我使用 Python SDK 接口 - boto3。

在文档中,我可以找到注册帐户的方法,但找不到经过身份验证的用户。文档:https : //boto3.readthedocs.io/en/latest/reference/services/cognito-idp.html

我的问题是,也许这个方法没有实现?所以,如果这个方法没有实现。也许有人为 AWS cognito 创建了一种用于身份验证的方法?

谢谢你们 :)

amazon-cognito boto3

8
推荐指数
1
解决办法
5168
查看次数

Amazon AWS Cognito和Python Boto3建立AWS连接并将文件上传到Bucket

我正在尝试使用AWS cognito服务来验证和上传文件.我已经提供了我的regionType,identityPool,AWS账户ID和UnAuthRole.我也知道生产和开发桶的名称.

我想我正在设置AWS Access Key和AWS Secret Key ...我想使用cognito进行身份验证并使用结果来允许我进行存储桶列表以及稍后的文件上传.

我究竟做错了什么?如何使用cognito id建立S3连接?

这是我的代码和产生的错误:

#!/usr/bin/python

import boto3
import boto
#boto.set_stream_logger('foo')
import json
client = boto3.client('cognito-identity','us-east-1')
resp =  client.get_id(AccountId='<ACCNTID>',IdentityPoolId='<IDPOOLID>')
print "\nIdentity ID: %s"%(resp['IdentityId'])
print "\nRequest ID: %s"%(resp['ResponseMetadata']['RequestId'])
resp = client.get_open_id_token(IdentityId=resp['IdentityId'])
token = resp['Token']
print "\nToken: %s"%(token)
print "\nIdentity ID: %s"%(resp['IdentityId'])
resp = client.get_credentials_for_identity(IdentityId=resp['IdentityId'])
secretKey = resp['Credentials']['SecretKey']
accessKey = resp['Credentials']['AccessKeyId']
print "\nSecretKey: %s"%(secretKey)
print "\nAccessKey ID: %s"%(accessKey)
print resp
conn = boto.connect_s3(aws_access_key_id=accessKey,aws_secret_access_key=secretKey,debug=0)
print "\nConnection: %s"%(conn)
for bucket in conn.get_all_buckets():
    print bucket.name
Run Code Online (Sandbox Code Playgroud)

错误:

   Traceback (most recent …
Run Code Online (Sandbox Code Playgroud)

python amazon-s3 boto amazon-web-services boto3

6
推荐指数
1
解决办法
1万
查看次数