Skip to main content

One-Type-One-Secret Access

Flash one product secret for the whole type. Devices check in over HTTP, get their own MQTT account, then open the long session. Less factory work; aim for first-pass.

Lingdian splits “prove the product” (HTTP activate) from “join the broker” (per-device mqttAccount). That split is what makes remote triage possible.

You care aboutHow the platform holds it
Fast productionShared ProductKey / ProductSecret per type
Traceable sessionsEach unit gets its own mqttAccount on gmqtt
Keys stay in laneProductSecret is activate-only, never MQTT login

1. Steps​

  1. Create product model (device_auth), copy product cert
  2. Create device (or pre-register → activate); confirm system_identifier
  3. Burn ProductKey / ProductSecret / model into same-type firmware
  4. Call activate (one_type_one_key)
  5. Store mqttAccount, connect gmqtt, report by Topic
  6. Verify online + dual-track logs

2. Flow​

3. Operations​

Platform​

Product / gateway model → device auth → product cert for ProductKey / ProductSecret. Create the device first (or pre-register). No system_identifier on file → activate fails.

Factory​

Burn shared secrets into firmware. Do not print ProductSecret on public QR labels.

Device activate​

POST …/register/auth/authenticate

Request:

{
"system_identifier": "<system_identifier>",
"auth_type": "one_type_one_key",
"auth_data": {
"product_key": "<ProductKey>",
"product_secret": "<ProductSecret>",
"model_number": "<model_number>"
},
"timestamp": 1710000000000
}

Success response:

{
"system_identifier": "<system_identifier>",
"timestamp": 1710000000000,
"mqttAccount": {
"username": "<mqttUsername>",
"password": "<mqttPassword>",
"clientId": "<clientId>",
"mqttHostUrl": "<broker-host>",
"port": "<mqtt-port>",
"ssl": true,
"useSsl": true
}
}
FieldMeaning
system_identifierDevice id; same as request
timestampServer response time
mqttAccount.usernameMQTT username (not ProductSecret)
mqttAccount.passwordMQTT password
mqttAccount.clientIdMQTT ClientId (usually device id)
mqttAccount.mqttHostUrlPublic broker host
mqttAccount.portPublic entry port (TLS on/off often same port)
mqttAccount.ssl / useSslConnect with TLS; synonyms — treat true as TLS

Keep only mqttAccount locally; honor ssl / useSsl, then talk to gmqtt.

4. Pitfalls​

SymptomThink first
Activate failsGateway ledger missing on platform, or no pre-registered device; system_identifier mismatch; wrong secret / model
MQTT rejectedUsing ProductSecret as MQTT password; ssl / useSsl vs actual client mode
Whole type at riskProductSecret leaked — rotate + reflash

Next​

One-Device-One-Code · MQTT Gateway · Architecture