Updated on 2024-12-02 GMT+08:00

Authenticating a Device

Process Description

Figure 1 Device authentication process

LwM2M Object Resource

When a device registers with the 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 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, which uniquely identifies a device. This parameter is specified during device registration on the 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"}