Shared Device username JavaScript

R
Robert
Zebra (OVS High Tier) - Axfoods

Hi,
Trying to get the username of the current logged in user on a shared device by calling mobicontrol.sharedDevice.currentUser.name but it always returns null.

This is the method used described in the documentation:
https://www.soti.net/mc/help/javascriptapi/en/mobicontrol.sharedDevice.User.html

For example i try with this:
mobicontrol.log.info("User logged in: " +mobicontrol.sharedDevice.currentUser.name);

But its only returns:


In the WebConsole i see the user is logged in and i see the username:




Tested with Android Agent version 2025.1.2.1214

Have anyone got this working in JavaScript?

Regards

Robert

5 months ago
Android Scripting
ANSWERS
RS
Rafael Schäfer
5 months ago

I don't use shared device mode yet but have you chjecked by a previous check-in that the login state you see in the console is the real status?
Does the example script from the guide work (ofc with changed name)?

R
Robert
4 months ago

Yes device is logged in I see the state when open the agent on the device.
Tested with the example script from the guide with my username logged in to device but does not work either. The first part mobicontrol.sharedDevice.isUserLoggedIn works fine it returns true but not the username.

RS
Rafael Schäfer
4 months ago

i meant the whole script, so pointing to the explicit username as in the example, does that work?
Do you use maybe latest agent, so ensuring the agent provides this functionality?


Otherwise i guess you may need to ask support whats going on/wrong here.

R
Remy
4 months ago

Hi,

I tested it, and on my end the command returns as expected

R
Robert
4 months ago

Hi Remy,
Good to hear it works for you, have you also Microsoft Authenticator configured as the Single sign-on app for shared device? Or some other method?

R
Remy
4 months ago

just LDAP

N
NSMOD@soti.net
3 months ago

Hi Robert, 

I hope the suggestions provided by Rafael and Remy have helped you answer your query. Please inform us if you require further assistance. 

Additionally, if any response has helped address your inquiry, we kindly request you to mark it as "is solution" so that others may also benefit from this information.

Thank you Matt for your valuable suggestions.

Thank you for choosing SOTI.

Regards,

Technical Support | SOTI Inc. |1.905.624.9828 | support@soti.net | www.soti.net