# Logging Into A Specific Client With A Script

**URL:** <https://forum.inductiveautomation.com/t/logging-into-a-specific-client-with-a-script/102804>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [February 24, 2025, 5:39pm UTC](https://forum.inductiveautomation.com/t/logging-into-a-specific-client-with-a-script/102804 "2025-02-24T17:39:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [February 24, 2025, 5:39pm UTC](https://forum.inductiveautomation.com/t/logging-into-a-specific-client-with-a-script/102804/1 "2025-02-24T17:39:32Z")

</div>

Hey Ignition Community

Looking to try something out. Trying to use my existing barcode readers on the floor to scan employee badges, get username and password, and log into a specific project on a pre designated client.

Getting the user and password from the badge number is easy, what to do after is not so much.

Any ideas are helpful

---

<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:** [February 24, 2025, 5:53pm UTC](https://forum.inductiveautomation.com/t/logging-into-a-specific-client-with-a-script/102804/2 "2025-02-24T17:53:37Z")

</div>

Set up auto-login as a 'guest' user with permissions to a particular window that has a label (or whatever) telling the end user to scan their badge to log in.

Use scripting to process the badge and then [`system.security.validateUser`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-security/system-security-validateUser) to check if the credentials are valid. Then, use [`system.security.switchUser`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-security/system-security-switchUser) to change to the provided user credentials.

Alternately, use two projects and use [`system.util.retarget`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-util/system-util-retarget) function to switch to the "real" project.

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [February 24, 2025, 8:12pm UTC](https://forum.inductiveautomation.com/t/logging-into-a-specific-client-with-a-script/102804/3 "2025-02-24T20:12:48Z")

</div>

Hey Paul,

how would I get that directed to a specific client?

---

<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:** [February 24, 2025, 8:18pm UTC](https://forum.inductiveautomation.com/t/logging-into-a-specific-client-with-a-script/102804/4 "2025-02-24T20:18:23Z")

</div>

To what is the badge scanner attached? I think Paul is assuming it is connected directly to a particular client.

If connected to the gateway, via device connection or otherwise, you will need to use `system.util.sendMessage()` to broadcast to running Vision Clients and have them, in their client-side message handler, determine if the message applies to that instance. Then it can run `system.security.switchUser`. (I think Paul's suggestion to use `system.util.retarget()` is mistaken.)

You will not be able to impact a workstation that is not running a Vision Client at all, nor will you be able to affect a workstation that is running a different project.

---

<div class="post-metadata">

**Author:** ![Jason\_Platt](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Jason\_Platt](https://forum.inductiveautomation.com/u/Jason_Platt)\
**Post date:** [February 24, 2025, 8:18pm UTC](https://forum.inductiveautomation.com/t/logging-into-a-specific-client-with-a-script/102804/5 "2025-02-24T20:18:37Z")

</div>

I should of posted it earlier, the barcode reader is connected to the PLC, so the badge number is an OPC tag
