Skip to main content

One-Device-One-Code Access

The code says which unit; the secret says it may enter. Enclosure QR / SN is identity only. DeviceSecret travels a secure channel. Activate once, MQTT with your own account.

Unlike one-type-one-secret, each unit has its own secret. Use when blast radius must stay per-device, or the factory prints per-unit labels.

Platform auth type: one_device_one_key. Field language often says “one device one code” — code ≠ secret; never put both on the same sticker.

You care aboutHow the platform holds it
Shipping labelsPre-register → factory print → activate
Small blast radiusDeviceSecret is per unit
Safe scanningQR carries identity only

1. Steps​

  1. Product model = device auth
  2. Path A: admin-create device · Path B: pre-register → label → activate
  3. Deliver DeviceSecret securely; print only the unique code on the label
  4. Activate (one_device_one_key) or finish pre-register activate
  5. Store mqttAccount, connect gmqtt
  6. Check online; owned gateways may use mini-program scan

2. Flow​

3. Operations​

Path A — pre-register: model → pre-register ledger → factory labels → activate (device + MQTT appear only then).

Path B — already created: admin adds device with DeviceSecret; unit calls HTTP activate.

Owned-gateway scan flow: MQTT Gateway.

{
"system_identifier": "A2602280610",
"auth_type": "one_device_one_key",
"auth_data": {
"device_secret": "<DeviceSecret>"
},
"timestamp": 1710000000000
}

4. Pitfalls​

SymptomThink first
Scan does nothingStill pre-registered, not activated
Activate failsWrong DeviceSecret / identifier mismatch
Secret on the labelQR must not carry DeviceSecret

Next​

One-Type-One-Secret · MQTT Gateway · TH-601