Skip to content
OneSay Developers

Security

Device Provisioning

The Device provisioning flow, as served on the pre-production environment:

The Device provisioning flow, as served on the pre-production environment:

  1. An authorized developer creates one Device in a Project Environment: in the Console under Devices, or with createDevice.
  2. Platform returns a five-minute, single-use provisioning code. A new code is issued with createDeviceProvisioningSession.
  3. The device exchanges the code once with exchangeDeviceProvisioningCode (POST /v1/device-provisioning/exchange) and receives its own device secret. On ESP32 the SDK's call is onesay_esp32_control_exchange_provisioning. The SDK's examples do not contain this step: your firmware makes it, once, and keeps the secret.
  4. The device stores the secret in the secure storage your firmware provides (encrypted NVS on ESP32 when your firmware enables it).
  5. The device exchanges the secret for a short-lived, audience/grant-bound access token with exchangeDeviceAccessToken (POST /v1/device-access-tokens).
  6. Realtime uses a separate 60-second, one-time connection ticket.

The device secret is not a Project API key and is never sent on normal API or Realtime requests. Rotate it with rotateDeviceCredential (the Console's Devices view). Revoking the Device revokes its credentials and makes previous access tokens and unconsumed Realtime tickets fail immediately.

Change a Device's permissions with updateDevice and its permissions member: the complete set, within the Device permission ceiling and what you may delegate. A widening takes effect at the Device's next access token with the same device secret, so nothing is re-provisioned and the board is not touched. A narrowing takes effect at the next check. Grants another owner gave the Device (a Delegation's pair Grants) are not changed.

The symmetric-secret design is for development boards. It is not a claim of manufacturing PKI, attestation, Secure Boot, Flash Encryption or secure-element support. Verification on a physical ESP32 board is planned and not done yet.