amazon web services - When using Cognito credentials with AWS in a browser (javascript), keep getting "missing credentials" error -
i'm attempting upload file s3 bucket of mine web browser using aws' javascript sdk. code looks this:
aws.config.credentials = new aws.cognitoidentitycredentials({ accountid: 'dfhgdh', identitypoolid: 'fdagsd', rolearn: 'fdafds' }); var bucket = new aws.s3({params: {bucket: 'test-bucket'}}); var pdfupload = document.getelementbyid('pdf-uploads').files[0]; var params = {key: pdfupload.name, contenttype: pdfupload.type, body: pdfupload}; bucket.putobject(params, function (error, data) { if (error) { console.log(error); } else { console.log(data); } });
however, whenever reaches putobject command, keep getting error aws:
"error: missing credentials in config {message: "missing credentials in config", code: "credentialserror"..."
i'm sure i'm missing simple , stupid here, can't figure out life of me. (i different error when try hardcode bogus secret key in or something, i'm pretty sure has way i'm trying set cognito credentials.)
| can include full contents of error message receive? credentialserror seems cut off. – bob kinney dec 18 '14 @ 18:07 |