AWS缺少身份验证令牌

时间:2016-03-06 22:03:15

标签: rest authentication amazon-web-services aws-cli aws-iot

我正在关注使用Node.js SDK将Raspberry Pi连接到AWS IoT的{​​{3}}。我在vim ~/.aws/credentials

中看到以下内容
[default]
aws_access_key_id = SOMETHING
aws_secret_access_key = SOMETHINGELSE

当我输入命令aws iot describe-endpoint时,我收到以下回复:

{
    "endpointAddress": "A34SXNTM6AT7XH.iot.us-west-2.amazonaws.com"
}

但是,当我浏览到该网址时:this tutorial 我收到以下错误:

Missing Authentication Token

https://a34sxntm6at7xh.iot.us-west-2.amazonaws.com/

知道可能出现什么问题以及如何解决?

enter image description here

enter image description here

这是~/certs文件夹中的文件:

pi@raspberrypi:~/certs $ ls
certificate.pem.crt  private.pem.key  public.pem.key  root-CA.pem

3 个答案:

答案 0 :(得分:2)

莫纳,

您的自定义端点响应两个协议:MQTT和HTTPS。但是,它不提供任何Web内容,因此无法在浏览器中作为站点URL工作。您从aws iot describe-endpoint获得的“endpointAddress”将插入您在链接的Raspberry Pi示例中使用的Node.js设备SDK(无https://)。

您还可以使用AWS签名版本4对请求进行签名,使用端点的HTTPS版本与设备阴影进行交互。更多相关内容:http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-rest-api.html和此处:http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html尽管您可能会开始使用通过使用AWS CLI或AWS SDK执行此类操作,可以更快地完成此操作。

Ryan @ AWS

答案 1 :(得分:1)

默认情况下,示例程序将在当前目录中查找证书和私钥文件,但如果需要,还可以使用“-f”选项指定另一个目录。至于您在尝试从浏览器访问端点时发现的“丢失身份验证令牌”消息,您可以放心地忽略它。

答案 2 :(得分:1)

如果您使用“TLS相互身份验证”,则需要在端口8443上进行连接,因此在您的示例中,它将是https://a34sxntm6at7xh.iot.us-west-2.amazonaws.com:8443/things/<thing_name>/shadow

相关问题