AWS凭证无法从android示例应用程序正常工作 [英] aws credentials are not working from android sample app
问题描述
我正在使用AWS MOBILE HUB提供的示例应用程序,并且在运行时可以运行。但是每当我将amazonaws文件夹复制到我的项目时,我都会收到有关凭据的错误消息。当我尝试对dynamodb运行查询时遇到此错误
I am using the sample app provided from the AWS MOBILE HUB and when I run it works. But whenever i copy the amazonaws folder to my project I get an error with regards to the credentials. This the error i get when i try to run a query to dynamodb
Caused by: com.amazonaws.AmazonServiceException: User: arn:aws:sts::033145769257:assumed-role/getitdelivery_unauth_MOBILEHUB_927752501/CognitoIdentityCredentials is not authorized to perform: dynamodb:Query on resource: arn:aws:dynamodb:us-east-1:033145769257:table/getitdelivery-mobilehub-927752501-Deliveries/index/Todays_Order (Service: AmazonDynamoDB; Status Code: 400; Error Code: AccessDeniedException; Request ID: JEDMKDQ6JMOTVPIMF85VJHSMGFVV4KQNSO5AEMVJF66Q9ASUAAJG)
推荐答案
您应该查看一下IAM政策。 Mobile Hub使用其生成的示例应用程序为您配置了所有这些功能,但是由于您已将某些内容复制到自己的项目中,因此可能需要更新策略,以便您的unauth角色有权执行以下操作: dynamodb:在资源上查询
: arn:aws:dynamodb:us-east-1:033145769257:table / getitdelivery-mobilehub-927752501-Deliveries / index / Todays_Order
。
You should take a look at your IAM Policy. Mobile Hub configures all of this for you with their generated sample application, but since you copied some things to your own project, you might need to update the policy so that your unauth role has permission to do: dynamodb:Query
on resource: arn:aws:dynamodb:us-east-1:033145769257:table/getitdelivery-mobilehub-927752501-Deliveries/index/Todays_Order
.
可以在此处找到该策略的示例:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/using-identity-based-policies。 html
An example of what the policy should look like is found here: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/using-identity-based-policies.html
这篇关于AWS凭证无法从android示例应用程序正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!