How to get a unique ClientID/DeviceID from chrome app/extension?

In your manifest.json

{
  ...
  "permissions": [
    "enterprise.deviceAttributes"
  ]
}

Execute the following code when your application loads. It will fetch the value of the device identifier of the directory API, that is generated by the server : enterprise_deviceAttributes

It will output 32 characters long alpha numeric id. For example, 352z2721-77cc-aa1d-91a2-rc382c42a5a0

chrome.enterprise.deviceAttributes.getDirectoryDeviceId(function(deviceId) {
    console.debug('DeviceIdOfTheDirectoryAPI', deviceId); 
});

Important Note :

The chrome OS device has to be enrolled via enterprise enrollment: Enroll Chrome devices

The chrome has to be installed forcefully on the chrome OS devices : Automatically install apps and extensions


You may also like...