User - Node Mapping
Before the devices under a node can be monitored and controlled remotely, the node should be first mapped to a user so that only that specific user can have permissions to access it. The workflow is driven from a client like the Phone app or RainMaker CLI.
The below sequence diagram will help to understand the steps.
Here are the steps
During Wi-Fi provisioning, the client sends the User Id and a randomly generated secret key to the ESP32-S2. It gets back the Node Id in return.
The client sends the node id and secret key to the RainMaker Cloud over a secure, logged-in session. User Id is not sent as it is extracted by the Cloud from the session information. It gets back a request id in return.
The ESP32-S2 sends the Node Id, User Id and Secret Key to the RainMaker Cloud over secure MQTT.
Steps 2 and 3 can occur even in reverse order, without affecting the workflow.
- The client keeps checking the status of the request based on the request id. Following are the possible responses
- Confirmed: If the RainMaker Cloud gets the same information from both, the client and the ESP32-S2 and considers it as a successful mapping.
- Timed Out: If 1 minute has passed since the request was made, but no matching information was received from the other end.
- Requested: Mapping is still in progress. Keep checking.