Hi everyone!
I currently use Cumolocity IoT (Free Trial) and Node-Red v3.1.0 and I need to communicate my field equipment through node-red and send the information to Cumolocity IoT.
Reviewing information from the documentation I found the following: “Device Integration using REST”
However, when I use my nodes in node red I get an invalid credentials error when trying to send data via REST (HTTP Request node):
Error Message:
msg.payload : string[200]
“{“error”:“security/Unauthorized”,“message”:“Invalid credentials! : Bad credentials”,“info”:“htp/www.cumulocity.com/guides/reference/rest-implementation//#a-name-error-reporting-a-error-reporting”}”
I share some screenshots of my node flow and configuration:
-
Node-Red Flow:
It consists of an inject node, connected to a function node and finally sent through an “HTTP Request” node -
Configuration of HTTP REQUEST node:
-
Configuration of FUNCTION node:
const newDeviceData = {*
“c8y_IsDevice”: {},*
“name”: “HelloWorldDevice”*
};*
msg.payload = newDeviceData;
return msg;
- Credentials of User
The user “AFlores” has all the roles and privileges of Cumolocity IOT
Finally comment on my tenant information:
TenantId: env770035
User: AFlores
PS1: The interesting thing is that with this account env770035/AFlores I have been able to communicate via MQTT to Cumolocity IoT (Free Trial)
PS2: For the username and password in RES, I understand that it must be encoded in Base 64 under the following nomenclature “Basic TenantID/User:Password”, and that is how it is configured in the red node (HTTP REQUEST NODE), however the error does not disappear.
I thank everyone for their support and I hope you can give me some idea of what is happening.