aws-samples / aws-sdk-unity-samples

This repository has samples that demonstrate various aspects of the AWS Mobile SDK for Unity, you can get the SDK source on Github (https://github.com/aws/aws-sdk-net)
Other
160 stars 107 forks source link

Simplified credentials + 400 error #6

Closed hgray closed 9 years ago

hgray commented 9 years ago

I'm trying out the simplified credentials using just the pool id. It is generating an identity on Cognito server every time I run, but it's returning a 400 error and is not writing the identity to the local db.

I'm getting the following: curl -X POST -H "X-Amz-Target: AWSCognitoIdentityService.GetCredentialsForIdentity" -H "Content-Type: application/x-amz-json-1.1" -H "User-Agent: AWS-SDK-UNITY/1.0.1" -H "X-HTTP-Method-Override: POST" -H "Accept: application/json" -d '{"IdentityId":"us-east-1:2ee56f8e-xxxx-xxxx-xxxx-a77c596a1bd8"}' https://cognito-identity.us-east-1.amazonaws.com/

I've confirmed each new identity is created in the Cognito dashboard.

If I modify SaveManager to use full credential values including accountId, poolId, unAuth, Auth, and region, it works, so this is unique to the GetCredentialsForIdentity() flow.

Any ideas? Thanks

P.S. Maybe this issue should go in the aws-sdk-unity issues instead?

turacma commented 9 years ago

It looks like you did not update your identity pool to associate roles. When you visit the Cognito console, you should see a banner telling you to associate your roles to your pool. This is a required step to use the simplified credentials constructor.

hgray commented 9 years ago

Great, thanks. I figured it was something along those lines. Thanks for the quick response.