# system.security.switchUser

**URL:** <https://forum.inductiveautomation.com/t/system-security-switchuser/84642>\
**Category:** Ignition\
**Tags:** ignition81, perspective, vision\
**Created:** [January 23, 2024, 3:07pm UTC](https://forum.inductiveautomation.com/t/system-security-switchuser/84642 "2024-01-23T15:07:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [January 23, 2024, 3:07pm UTC](https://forum.inductiveautomation.com/t/system-security-switchuser/84642/1 "2024-01-23T15:07:16Z")

</div>

I am updating a vision project to perspective. That vision project has a button with this script on it:

```auto
# This script would go on a button in a popup window used to switch users without logging out of the client.
  
# Pull the username and password from the input components
uname = event.source.parent.getComponent("Username").text
pwd = event.source.parent.getComponent("Password").text
  
# Call switchUser. The event object is passed to this
# function so that if the username and password work,
# this window will be closed before the switch occurs.
success= system.security.switchUser(uname,pwd,event,hideError=True)

if success:
	system.tag.write('[Client]user', uname)
	event.source.parent.getComponent('PasswordError').visible = False
	system.nav.closeParentWindow(event)
  
# If the login didn't work, give input focus back to the
# username component, so that the user can try again
if not success:
	event.source.parent.getComponent("Username").requestFocusInWindow()
	event.source.parent.getComponent('PasswordError').visible = True

```

Does the system.security.switchUser validate against the user/roles - user sources?

---

<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:** [January 23, 2024, 3:15pm UTC](https://forum.inductiveautomation.com/t/system-security-switchuser/84642/2 "2024-01-23T15:15:45Z")

</div>

Perspective does not have equivalent functionality. You can navigate to a URL of a different project, but authentication cannot be forced.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [January 23, 2024, 3:26pm UTC](https://forum.inductiveautomation.com/t/system-security-switchuser/84642/3 "2024-01-23T15:26:55Z")

</div>

Oh, hmm... anything remotely like that in perspective?

---

<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:** [January 23, 2024, 3:27pm UTC](https://forum.inductiveautomation.com/t/system-security-switchuser/84642/4 "2024-01-23T15:27:45Z")

</div>

> [@mjohnson0238](#):
>
> remotely like that in perspective?

> [@pturmel](#):
>
> You can navigate to a URL of a different project, but authentication cannot be forced.

That's it.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [January 23, 2024, 3:28pm UTC](https://forum.inductiveautomation.com/t/system-security-switchuser/84642/5 "2024-01-23T15:28:52Z")

</div>

LOL, thanks. Ill just have a text field that has to have a certain passcode in it to enable/disable a function

---

<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:** [January 23, 2024, 3:31pm UTC](https://forum.inductiveautomation.com/t/system-security-switchuser/84642/6 "2024-01-23T15:31:49Z")

</div>

If that's the purpose, consider using Perspective's authentication challenge function--allows checking another user's credentials through the project IdP without actually switching users.
