cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Switch Logged in Users through script

AhsanKhan
4-Participant

Switch Logged in Users through script

Hey guys, I am wondering how I go about programmatically logging in a User using some kind of known information that correlates with that user.

6 REPLIES 6
PaiChung
22-Sapphire I
(To:AhsanKhan)

What is the use case for this?

AhsanKhan
4-Participant
(To:PaiChung)

Hey thanks for the reply, I want to have 2 users in thingworx and depending on which language someone picks I want to log them into a certain user so their language preference appears.

PaiChung
22-Sapphire I
(To:AhsanKhan)

You can't just set their Language Preference in their actual user?

The other way to do it, is to load the language preference upon a choice vs. switching users.

I think that is better than logging in another user automatically which has potential security concerns.

AhsanKhan
4-Participant
(To:PaiChung)

The issue is that our program does not utilize the Users feature normally and we have everyone logged in as TVUSER and we use our own authentication system within the app. What im hoping for is we have 2 new users which each have a default language we can log people in and out of. Is this something that is possible through a script?

PaiChung
22-Sapphire I
(To:AhsanKhan)

In older versions of ThingWorx you could use an appkey and make the session persist, not sure if that is still possible.

Aside from that, I have seen implementations where the language tokens were loaded on demand vs. associated with the user, so that might be a better option to explore. I apologize because its been a long time since I've seen that implementation so I am not completely certain how it was done, you can perhaps create a new thread asking about how to load language tokens on demand.

AhsanKhan
4-Participant
(To:PaiChung)

Hey thanks for all the replies, I will actually go ahead and ask that question in a new thread and see if anyone has done something similar. Thanks again.

Top Tags