Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

S3 Transfer Manager sample shows error: Unauthenticated access is not supported

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:

  • aws-android-sdk-2.0.4-cognito.jar
  • aws-android-sdk-2.0.4-core.jar
  • aws-android-sdk-2.0.4-s3.jar

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?

like image 822
Vivek Avatar asked Jul 22 '14 16:07

Vivek


People also ask

Why am I getting an access denied error from the Amazon S3 console while I modify a bucket policy?

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.

Why is S3 object URL Access Denied?

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.


1 Answers

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!

like image 82
Richard Fung Avatar answered Nov 06 '22 00:11

Richard Fung