Sorry to have problems with the sample. There are two things that I think can solve your problem.
First, have you included unauthorized access in the Congito identifier pool? You can check by going to the Cognito console, going to the Edit Identity Pool and seeing if Enable access to Unauthenticated Identities .
Secondly, you need to set COGNITO_ROLE_UNAUTH . To do this, you first need to go to the IAM console and create a role if you do not already have it. Then click the role in the IAM console and click Summary . The first thing on the Summary tab should be Role ARN . Replace YOUR_COGNITO_UNAUTH_ROLE with the value found there.
Hope this helps, and I will see if we can make the documents clearer. Sorry for the trouble again!
Richard Fung
source share