I am trying to create a Hit on Amazon mechanical turk. I am currently using Meteor, so I don't have an SDK (that I know of) that I can use.
In order to create the hit, I am using the following code:
Mturk.createHit = function(jobAttributes) {
var operation = "CreateHIT";
var service = "AWSMechanicalTurkRequester";
var timestamp = moment().toISOString();
var encoded = CryptoJS.HmacSHA256(service + operation + timestamp, process.env.SECRET_ACCESS_KEY).toString();
var hitResponse = Meteor.http.get(
"https://mechanicalturk.sandbox.amazonaws.com",
{
params: {
Service: service,
AWSAccessKeyId: process.env.ACCESS_KEY_ID,
Version: "2013-11-15",
Operation: operation,
Signature: encoded,
Timestamp: timestamp,
Title: 'Survey',
Description: 'Survey Description',
Reward: {
Amount: 5,
CurrencyCode: 'USD'
}
}
}
);
console.log(hitResponse);
}
Every time I submit this, I get the following error:
AWS.BadClaimsSupplied The specified claims are invalid. Based on your request, your signature should be generated using the following string: AWSMechanicalTurkRequesterCreateHITs2014-11-13T05:41:31.357Z. Check to make sure your system clock and timezone is not incorrect. Our current system time: 2014-11-13T05:41:31Z.
I think that the error is coming from improperly creating my signature, but I am not sure exactly how to proceed. I have tried using base64 encoding, but that hasn't worked for me either. Any ideas?