本文介绍了如何使用Javascript为AWS创建签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Node.js为AWS Mechanical Turk创建签名,但是这样做很麻烦.目前,我正在使用以下内容,但仍会出现错误:
I am trying to create the signature for AWS Mechanical Turk, using Node.js, but am having trouble doing so. At the moment I am using the following, but keep getting errors:
CryptoJS.HmacSHA1(service + operation + timestamp, process.env.SECRET_ACCESS_KEY);
有关签名的说明,请参见链接.它指出要创建一个签名
The explanation of the signature is at this link. It states that to create a signature
推荐答案
我认为这很适合您(我使用GetAccountBalance
)作为一个简单示例:
I think this will work for you (I use GetAccountBalance
) as a simple example:
<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/hmac-sha1.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/components/enc-base64-min.js"></script>
<script>
var service = "AWSMechanicalTurkRequester";
var timestamp = new Date().toISOString();
var operation = "GetAccountBalance";
var secret = "YOURSECRETKEY";
var signature = CryptoJS.HmacSHA1(service + operation + timestamp, secret).toString(CryptoJS.enc.Base64);
</script>
这篇关于如何使用Javascript为AWS创建签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!