Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
When experience is marked as "requires authentication" and logs in - is it possible to retreive user information? Just want to know if it was userA or userB.
Then when services are invoked from experience is it possible to have authenticated user information?
You can get the user name from the CurrentSessionInfo.GetCurrentUser() method:
1) In "External Data", click the + to add an item
2) Search for "CurrentSessionInfo" under "Entities"
3) Select it, and switch to "Services" on the right.
4) Search for "GetCurrentUser", and click the green + to add it to your project
5) Back in the project window, under External Data, find CurrentSessionInfo->Services->GetCurrentUser->Configuration and expand it
6) Make sure the "Invoke on startup" option is checked.
You can now link that to an app parameter or directly to a targetable widget field (like the "text" field of a textbox). You can also access the value in script code using
$scope.app.mdl['CurrentSessionInfo'].svc['GetCurrentUser'].data[0].result
I'm not quite sure what your second question is getting at, but hopefully this will be enough to get you going down the right path.
I will add some context:
Note: Tested on Android 8, View 8.3.6.
Note2: invoking CurrentSessionInfo.GetCurrentIP service from Twx, returns always 127.0.0.1 for me (probably because my ES and Thingworx are on the same host), so it does not seem to be device IP.
For the second part of my question about tracking what user invoked what service in Thingworx - all is visible in Monitoring (when specific user get visibility and runtime permissions).