angularjs - AWS Cognito Invalid login token error with my token from Developer authentication -


i want put object aws s3 directly browser on angular js.
this, use cognito developer authentication. got cognito identity id , token rails server.

with token(i think valid), put action rejected aws s3 : invalid login token.
i don't know why..

here code.

aws.config.region = 'us-east-1'; aws.config.credentials = new aws.cognitoidentitycredentials({   accountid: '0000',   identitypoolid: 'us-east-1:0000-0000-0000',   rolearn: 'arn:aws:iam::0000:role/myrolename',   logins: {     'cognito-identity.amazonaws.com': 'token cognito.get_open_id_token_for_developer_identity'   } }); var bucket = new aws.s3({ params: { region: 'ap-northeast-1', bucket: 'my bucket name' }}); 

(0000 parts sample)
wonder there no space 'identity_id' cognito.get_open_id_token_for_developer_identity.
config regioin , s3 region different because use tokyo s3 n.virginia cognito.

++ added s3 full access managed policies in role(myrolename), , added below setting inline policy. (i added 'resource * version of below setting' inline policy)

{     "version": "2012-10-17",     "statement": [         {             "sid": "0000",             "effect": "allow",             "action": [                 "s3:getobject",                 "s3:putobject"             ],             "resource": [                 "arn:aws:s3:::mybucketname"             ]         }     ] } 

it looks trying use "basic authflow". here link our documentation on auth flows:
http://docs.aws.amazon.com/cognito/devguide/identity/concepts/authentication-flow/#developer-authenticated-identities-authflow

this not using token providing in logins map.

i recommend using "enhanced authflow". this:
(1) make sure identity pool configured roles wish users use: http://docs.aws.amazon.com/cognito/devguide/identity/concepts/iam-roles/
(2) remove accountid , rolearn arguments identity constructor.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -