【问题标题】:`SignatureDoesNotMatch` Response from AWS of Alexa Top Sites Service来自 Alexa Top Sites Service 的 AWS 的“SignatureDoesNotMatch”响应
【发布时间】:2014-12-01 22:39:34
【问题描述】:

我指的是Alexa Top Sites Developer Guide 并使用their sample codes, both PHP and Ruby。我收到以下SignatureDoesNotMatch 错误:

<?xml version="1.0"?>
<Response><Errors><Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
</Message></Error></Errors><RequestID>28c6b028-c4b6-66a2-f5d8-70d8dc21b8f8</RequestID>
</Response>

我为同一个用户尝试了两个不同的访问密钥并注册了 Alexa Web 信息服务,但没有成功。我在 Mac OS 10.9 和 10.10 上都尝试了脚本,我的时间设置设置为自动更新。

在 PHP 代码中,这是生成签名的部分:

/**
 * Generates a signature per RFC 2104
 *
 * @param String $queryParams query parameters to use in creating signature
 * @return String             signature
 */
protected function generateSignature($queryParams) {
    $sign = "GET\n" . strtolower(self::$ServiceHost) . "\n/\n". $queryParams;
    echo "String to sign: \n" . $sign . "\n\n";
    $sig = base64_encode(hash_hmac('sha256', $sign, $this->secretAccessKey, true));
    return rawurlencode($sig);
}

我不确定我做错了什么。

【问题讨论】:

  • 切换到标签cryptography,没有MAC标签,签名用于方法签名。

标签: php api amazon-web-services cryptography alexa


【解决方案1】:

我想通了。根 AWS 用户能够发出请求,但不能发出我创建的 IAM 用户。我猜根用户可以访问 Alexa 服务,但不能访问 IAM 用户。

【讨论】:

  • 感谢您的反馈,过一会您应该可以接受自己的答案了...
  • 你有没有弄清楚是否可以使用非 root 用户?
  • 到目前为止,您似乎仍然需要使用根密钥。我也无法让 IAM 工作。嘘!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-07-14
  • 1970-01-01
  • 2014-02-16
  • 1970-01-01
  • 1970-01-01
  • 2021-01-24
  • 1970-01-01
相关资源
最近更新 更多