# Way to revert to auto-log in user without saving credentials separately?

**URL:** <https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860>\
**Category:** Ignition\
**Tags:** vision, ignition81\
**Created:** [April 2, 2026, 2:23pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860 "2026-04-02T14:23:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 2, 2026, 2:23pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/1 "2026-04-02T14:23:54Z")

</div>

Using ignition 8.1.47, Vision.

Have a active directory user source. We have auto logged in enaled with a service account, but people log in and out all the time with there personal accounts to do things. My logout button really should only revert back to the auto logged in user so that the HMI is still viewable. Right now the only way I see to do this is to hardcode my credentials in a script and do a `system.security.switchUser`. I know I can do other better ways of storing the credentials and if theres no better way I will do that, but what I am more curious about is if there is a easier built in way to “revert” back to the autologged in user with a `system.*` call?

---

<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:** [April 2, 2026, 3:34pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/2 "2026-04-02T15:34:34Z")

</div>

> [@bkarabinchak.psi](#):
>
> with a `system.*`

No.

That said, I think we do keep track of the initial AuthenticationChallenge in memory and you could conceivably write a script to access this information, unpack it, and rinse _that_ through a system function.  
It'd be fragile, and guaranteed to break when you upgrade to 8.3, all that code changed.

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [April 2, 2026, 3:36pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/3 "2026-04-02T15:36:28Z")

</div>

Edit: Whoops, removed the perspective link as I missed the vision tag.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 2, 2026, 3:40pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/4 "2026-04-02T15:40:00Z")

</div>

I came up with this ugliness that does work but I am more inclined to just keep the creds somewhere

```python
from com.inductiveautomation.factorypmi.application.model.properties import LoginProps
from com.inductiveautomation.ignition.common.util import LoggerEx

def loginToAutoUser():
    log = LoggerEx.newBuilder().build("LoginPropReader")
    # Easieset way to get client context? lol prob not idk
    openWindow = system.gui.getOpenedWindowNames()[0]# I know at least one is open
    win - system.gui.getWindow(oepnWindow)
    context = win.getAppContext()
    project = context.getProject()
    loginProps = LoginProps.fromProjectResource(context, project, log)
    username = loginProps.getAutoLoginUsername()
    password = loginProps.getAutoLoginPassword()
    system.security.switchUser(username, password)

```

The above works but I don’t like not knowing exactly whats going on and if its safe. Maybe there’s a way to make the above not fragile and workable.

If not I’ll just put it somewhere and wait until a 8.3 for the secrets manager.

The pain point I am trying to address (which may be in 8.3) is keeping separate sets of credentials - one in the Vision project properties where I set the auto login information, and then the other file I am reading from to switch back to the auto login user.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 2, 2026, 3:42pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/5 "2026-04-02T15:42:38Z")

</div>

I am using vision so this available for my situation.

---

<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:** [April 2, 2026, 3:48pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/6 "2026-04-02T15:48:15Z")

</div>

You didn't hear this from me 😃

```python
from com.inductiveautomation.factorypmi.application import FPMIApp
context = FPMIApp.getInstance().adapterContext

```

Your code there would actually still work in 8.3 🤷

---

<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:** [April 2, 2026, 3:51pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/7 "2026-04-02T15:51:39Z")

</div>

I'm going to have to look at implementing this. I've just been storing an encrypted version of the password so that it isn't stored in plain text (using the internal encryption methods used to store DB credentials and the like in Ignition already), but if I can pull the auto-login credentials automatically, that's much better.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [April 2, 2026, 3:56pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/8 "2026-04-02T15:56:33Z")

</div>

With @paul-griffith ‘s full blessing and backing

```python
from com.inductiveautomation.factorypmi.application.model.properties import LoginProps
from com.inductiveautomation.ignition.common.util import LoggerEx
from com.inductiveautomation.factorypmi.application import FPMIApp

def loginToAutoUser():
    log = LoggerEx.newBuilder().build("LoginPropReader")
    context = FPMIApp.getInstance().adapterContext
    project = context.getProject()
    loginProps = LoginProps.fromProjectResource(context, project, log)
    username = loginProps.getAutoLoginUsername()
    password = loginProps.getAutoLoginPassword()
    system.security.switchUser(username, password)

```

Should `log = LoggerEx.newBuilder.build()` should be outside the function or better off inside? That I have no idea.

@michael.flagler yes I was trying to address that issue. Having two sources of these credentials is just one more thing that can get out of sync.

---

<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:** [April 2, 2026, 4:06pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/9 "2026-04-02T16:06:16Z")

</div>

Should be `system.util.getLogger`, and it's a micro-optimization but it would be "better" outside the function call.

The underlying objects are memoized under the hood so it's not really going to matter.

> [@bkarabinchak.psi](#):
>
> With @paul-griffith ‘s full blessing and backing

😉  
Little known fact, every time you `IgnitionGateway.get()` you also get a file written to disk that has a phone number for the big red phone on my desk so you can bypass support.

---

<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:** [April 2, 2026, 4:16pm UTC](https://forum.inductiveautomation.com/t/way-to-revert-to-auto-log-in-user-without-saving-credentials-separately/114860/10 "2026-04-02T16:16:54Z")

</div>

Here's what I came up with plus an extra check to make sure we're not in designer (not sure if it would even work in designer):

```python
from com.inductiveautomation.factorypmi.application.model.properties import LoginProps
from com.inductiveautomation.factorypmi.application import FPMIApp

logger = system.util.getLogger(system.util.getProjectName() + '.' + __name__ )

def loginToAutoUser():
	# Get system flags for determining if this is designer or not
	flags = system.tag.readBlocking(['[System]Client/System/SystemFlags'])[0].value
	
	context = FPMIApp.getInstance().adapterContext
	project = context.getProject()
	loginProps = LoginProps.fromProjectResource(context, project, logger)
	
	username = loginProps.getAutoLoginUsername()
	password = loginProps.getAutoLoginPassword()
	
	# Only perform the switch user if we're not in designer
	if (flags & 1) == 0:
		system.security.switchUser(username, password)
	else:
		logger.infof('Not switching user to "%s" due to running in designer', username)

```

Edit: Looks like it may not be necessary, but at least prevents the error dialog.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/0/e04dcf3e32e68fa6aaff001c9e26c00b8bd580a6.png)
