Search code examples
iosibm-mobilefirst

How to get iOS device ID in MobileFirst server adapter?


i want to be able to get the device id of iOS device in MobileFIrst or work light adapter.

I only see this method: WL.Server.getClientDeviceContext() But this does not contain device id.

The WL.Device.getId() - this is only available in the client.

Please advice- how to get device id of current request in adapter code(javascript)

Edit: Just to clarify, i am interested in client identifier for the current request made by a client device.


Solution

  • You have not mentioned why you need to capture deviceID at the server.I can think of three ways to achieve it:

    a) Use WL.Server.getClientRequest() API -

    var req=WL.Server.getClientRequest();                             
    WL.Logger.warn("X-WL-DEVICE-ID:::"+ req.getHeader("x-wl-device-id"));
    

    b) Use WL.Server.getCurrentDeviceIdentity() API -

    If there is a device identity associated with the device , the method returns the device identity. Device identity object contains deviceID. This API was introduced in MF 6.3

    c) For older versions , you could try -

    WL.Server.getActiveUser("wl_deviceNoProvisioningRealm");