An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
Getting 401 on REST call to IoTHub (on 'devicebound')
Hi Team,
I want to send C2D from a web page. I am able to make REST call to IoTHub on 'events' but not on 'devicebound'. I am getting unauthorized 401 when I post on 'devicebound'. On 'events', I get 204 as expected and I see my message on built-in endpoint.
Note: Just to be sure I have created SAS token with iothubowner policy. Am I missing anything? I believe the same SAS token should work for both, right? Maybe, there is gap in my understanding.
My REST code,
const response = await fetch(`https://myhub.azure-devices.net/devices/device_xyz/messages/devicebound?api-version=2020-03-13`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': sasToken
},
body: message
});
Azure IoT Hub
1 answer
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
8 deleted comments
Comments have been turned off. Learn more