Home » Android » android – S3 Transfer Manager sample shows error: Unauthenticated access is not supported

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

Posted by: admin June 15, 2020 Leave a comment

Questions:

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?

How to&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!