Updated on 2023-02-16 GMT+08:00

Authenticating a Device

Process Description

LwM2M Object Resource

When a device registers with the IoT platform, the platform authenticates the device.

Operation

CoAP Method

URI

Success

Failure

Register

POST

/rd?ep={nodeId}

2.01 Created

4.00 Bad Request,

4.03 Forbidden,

4.12 Precondition Failed

The platform subscribes to resources from the device. The device obtains the token delivered by the IoT platform for subscription. Token information must be carried when other APIs (for example, the API for property reporting) are called.

Operation

CoAP Method

URI

Success

Failure

Observe

GET with Observe option = 0

/19/0/0

2.04 Content with Observe option

4.00 Bad Request,

4.04 Not Found,

4.01 Unauthorized,

4.05 Method Not Allowed

Request Parameters

Parameter

Mandatory

Type

Location

Description

nodeId

Yes

String

Uri-Query

Node ID, used to uniquely identify a device. This parameter is specified during device registration on the IoT platform.

Register Request Example

CON-POST   MID=25995, Token=514078a73366, OptionSet={"Uri-Path":"rd", "Content-Format":"application/octet-stream", "Uri-Query":["ep=test"]}

Register Response Example

ACK-2.01   MID=25995, Token=514078a73366, OptionSet={"Location-Path":["rd","test"]}, no payload:

Observe Request Example

CON-GET    MID=48590, Token=2cb6a673cba24c04, OptionSet={"Observe":0, "Uri-Path":["19","0","0"], "Accept":"application/octet-stream"}, no payload

Observe Response Example

ACK-2.04   MID=48590, Token=2cb6a673cba24c04, OptionSet={"Observe":0, "Content-Format":"application/octet-stream"}