I am trying to run the AWS android samples from the following git repo: https://github.com/awslabs/aws-sdk-android-samples
I am receiving the following error message:
Unauthenticated access is not supported. (Service: AmazonCognitoIdentityService; Status Code: 400; Error Code: NotAuthorizedException; Request ID: 75be66eb-11b6-11e4-85d9-9933082e5eb2)
I have configured the AWS services as per the steps mentioned in the git repo url: https://github.com/awslabs/aws-sdk-android-samples/blob/master/S3_TransferManager/README.md
I have included the following jars in libs:
Also I have added the AWS_ACCOUNT_ID
, COGNITO_POOL_ID
and BUCKET_NAME
. I was
not sure where to find the COGNITO_ROLE_UNAUTH
so I left it at
YOUR_COGNITO_UNAUTH_ROLE
.
Could anyone tell me what I am doing wrong here?
The "403 Access Denied" error can occur due to the following reasons: Your AWS Identity and Access Management (IAM) user or role doesn't have permissions for both s3:GetBucketPolicy and s3:PutBucketPolicy. The bucket policy denies your IAM identity permission for s3:GetBucketPolicy and s3:PutBucketPolicy.
The URL to the Amazon S3 object doesn't include your user credentials, so the request to the object is anonymous. Amazon S3 returns an Access Denied error for anonymous requests to objects that aren't public.
Sorry that you're having trouble with the sample. There are two things which I think might solve your problem.
First of all, did you enable unauthenticated access in your Congito identity pool? You can check by going to the Cognito console, going to Edit Identity Pool
, and seeing if Enable access to Unauthenticated Identities
is checked.
Secondly, you'll need to set COGNITO_ROLE_UNAUTH
. To do this, you will first need to go to the IAM console and create a Role if you don't already have one. Then, click on the role in the IAM console and click Summary
. The first thing under the Summary
tab should be Role ARN
. Replace YOUR_COGNITO_UNAUTH_ROLE
with the value found there.
Hope that helps and I'll see if we can make the docs more clear. Sorry again for the trouble!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With