401 Unauthorized Response with ElectricImp

When an ElectricImp Agent is sending data to an Murano IoT Connector and receives a 401 Unauthorized HTTP response, if the device identity is already Provisioned it is likely that the authorization tokens do not match between the device and cloud. To get the tokens synced, we will clear the token for that device in the IoT Connector and force the ElectricImp Agent to re-provision:

Clear Token From IoT Connector Device
To clear the token in Murano, navigate to the device (named the same as the ElectricImp AgentID) and select “Clear/Reset device credentials…”

Force ElectricImp Agent to Re-Provision
In the ElectricImp Agent code, we will temporarily comment out code that checks for a current token. This will force the agent to re-provision:
Before:


After:

Select “Build and Force Restart” to Enable the Change
The Agent should now successfully send data to your Murano IoT Connector.

After the 401 error is resolved, return the Agent code back to the original state and “Build and Force Restart” one final time: