# Switch User Syntax with SSO

**URL:** <https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [June 5, 2025, 6:32pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104 "2025-06-05T18:32:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Averill](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@Michael\_Averill](https://forum.inductiveautomation.com/u/Michael_Averill)\
**Post date:** [June 5, 2025, 6:32pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/1 "2025-06-05T18:32:49Z")

</div>

All of our projects are configured to execute a system.security.switchUser script after 5 minutes of inactivity to log in with a local account with view-only access. We recently configured SSO, so this script is no longer working with the non-Active Directory account. We have tried using the credentials of an AD account, but the switch user function does not work. We have tried the following formats without success.

system.security.switchUser("Username", "Password")  
system.security.switchUser("Username", "Password",(),0)  
system.security.switchUser(Username,Password)

Is there a way to use the switchUser function with a project that has SSO enabled?

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 5, 2025, 7:19pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/2 "2025-06-05T19:19:54Z")

</div>

SSO is not recommended to be used in Vision anymore. I believe there's some security implications/concerns. If you do want to continue using it though, I don't have a solution for your problem. I would think this defeats the purpose of SSO if you're logging the user out after 5 minutes anyway.

---

<div class="post-metadata">

**Author:** ![Michael\_Averill](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@Michael\_Averill](https://forum.inductiveautomation.com/u/Michael_Averill)\
**Post date:** [June 5, 2025, 7:29pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/3 "2025-06-05T19:29:26Z")

</div>

This is for a project on an HMI in a winery that has controls for life safety equipment. If a user with control privileges forgets to log out, we want to switch to a user with view only access.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 5, 2025, 7:32pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/4 "2025-06-05T19:32:22Z")

</div>

So why inherently trust the logged in user at all? I would disable SSO and use auto-login on the project with a read-only user then make the user login with their credentials every time with an inactivity timeout. (At least this is how I do it at all the plants I do).

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 5, 2025, 7:33pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/5 "2025-06-05T19:33:35Z")

</div>

> [@michael.flagler](#):
>
> a read-only user

Crucially, taking advantage of Vision's user sources allowing "soft" failover, so that you can have insecure/guest credentials in an "internal" user source and can leave your AD with strong/secure passwords.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 5, 2025, 7:34pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/6 "2025-06-05T19:34:17Z")

</div>

> [@Michael\_Averill](#):
>
> Is there a way to use the switchUser function with a project that has SSO enabled?

As for this question - no, there's no way to initiate the (as mentioned, _very_ insecure) "legacy" SSO option for Vision from scripting.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 5, 2025, 7:43pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/7 "2025-06-05T19:43:53Z")

</div>

This is exaclty what I do. Local user source with a "readonly" user who belongs to no groups/roles. My AD user source has a soft failover to the local user source so the autologin with the readonly user works and my autologout script switches back to this same user. Works well.

---

<div class="post-metadata">

**Author:** ![Michael\_Averill](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@Michael\_Averill](https://forum.inductiveautomation.com/u/Michael_Averill)\
**Post date:** [June 5, 2025, 10:49pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/8 "2025-06-05T22:49:13Z")

</div>

The majority of our users are using personal laptops for access, so we would like to leave SSO enabled. For the shared devices in our wineries, since we cannot use the switchuser function, we would like to use either system.security.logout() or system.util.exit() after x minutes of inactivity. However, if another user logs back in, they are not required to enter their SSO credentials. Is there a way to automate the clearing of their SSO authentication, so the next user is required to enter credentials on a shared device?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 5, 2025, 11:55pm UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/9 "2025-06-05T23:55:06Z")

</div>

> [@Michael\_Averill](#):
>
> using personal laptops for access

I'd say that should disqualify the known insecure SSO.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 6, 2025, 12:16am UTC](https://forum.inductiveautomation.com/t/switch-user-syntax-with-sso/107104/10 "2025-06-06T00:16:14Z")

</div>

If you really want to go 2 directions with this to have laptops with SSO (which you now have several people with a lot of experience highly recommending you not use SSO), and still have shared devices that don't use SSO, you'll have to use inheritance on a parent project with all the resources on it, then change one of the projects to not use SSO (hopefully this is possible to split this) and override the few windows that handle the logon/logoff to allow it to use the switch user functionality to automatically log off the user.

Your best bet is to push back against this. Security and safety should never be compromised as the expense of convenience.
