我正在尝试使用 JAVA REST API 从 azure IOT 获取设备列表。 当我使用这个网址时
https:iothubhostname/devices/?maxCount=5&api-version=2015-07-01
它的响应如下:
ErrorCode:IotHubUnauthorizedAccess;Unauthorized
谁能帮助我们,如何将此请求作为授权请求?
最佳答案
从错误消息中,我们可以知道您的授权 header 有问题。以下截图是我的结果:
这是http请求详细信息:
如何生成Authorization header,请引用this article 。以下是本文的关键片段:
{signature} An HMAC-SHA256 signature string of the form: {URL-encoded-resourceURI} + "\n" + expiry. Important: The key is decoded from base64 and used as key to perform the HMAC-SHA256 computation.
希望这可以帮助您。
关于java - 如何解决错误代码:IotHubUnauthorizedAccess;Unauthorized?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43178450/