device.pair

As documented earlier, it is compulsory to pair a device with a user account before getting access to its data. Pairing feature is similar to claiming ownership over a device. When you send us a pairing request, we first verify that the device isn't paired to another account.

This method returns the following codes in response

DEVICE-PAIRED

device paired successfully and access token returned

DEVICE-ALREADY-PAIRED

device is already paired to another account

DEVICE-ID-INVALID

device is not registered with this id

DATA-INVALID

device id is required

Use of pair method has been illustrated in the example below

// Submit request to the server
device.pair().then((res) => {
  // Got the response
  switch(res.code) {
    case "DEVICE-PAIRED": 
      // Transfer the token to the device
      console.log(res);
  }
})