Not authorized to perform sts:AssumeRoleWithWebIdentity AWS s3 Cognito auth failure

后端 未结 1 659
刺人心
刺人心 2021-01-22 05:22

I have a simple iOS app that uploads to s3. I\'m trying unauth all around- even though ideally I want to do Facebook.

2 IAM Roles (created using the wizard). The IAM au

相关标签:
1条回答
  • 2021-01-22 05:57

    looking at your code, it looks like you were using the "Auth" role arn:aws:iam::[id num]:role/Cognito_Auth_DefaultRole as your unauth role. By default Amazon Cognito creates roles that only trust the specific kind of access (unauthenticated and authenticated), hence the sts error when trying with unauthenticated access. This blog post goes over trust policies and understanding how Cognito uses them.

    Switching to the simplified constructor should have fixed this for you, unless you also made the same association inside of the AWS console. Associating your roles in the console allows you to not embed your roles inside your application.

    Also, if you want to use a bucket outside of the "US Standard" region, you would need to change this line:

    AWSServiceConfiguration *configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionSAEast1
                                                                      credentialsProvider:credentialsProvider];
    

    To reflect the region where the bucket resides.

    0 讨论(0)
提交回复
热议问题