# system.security.getUsername doesn't work in perspective

**URL:** <https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [November 24, 2020, 10:18pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934 "2020-11-24T22:18:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [November 24, 2020, 10:18pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/1 "2020-11-24T22:18:05Z")

</div>

How do I get the current user logged in to a client?Thx, jake

---

<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:** [November 24, 2020, 10:21pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/2 "2020-11-24T22:21:25Z")

</div>

`session.props.auth.user.userName`:  
[https://docs.inductiveautomation.com/display/DOC81/Session+Properties#SessionProperties-SessionPropertiesTable](https://docs.inductiveautomation.com/display/DOC81/Session+Properties#SessionProperties-SessionPropertiesTable)

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [November 24, 2020, 10:35pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/3 "2020-11-24T22:35:04Z")

</div>

I can’t seem to use that var directly, says session isn’t defined, and the system.perspective.getSessionInfo seems to be a way to get info from running sessions on the server, past and present.Thx, jake

---

<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:** [November 24, 2020, 10:40pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/4 "2020-11-24T22:40:12Z")

</div>

Where are you calling from? A script? What’s triggering the script?

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [November 24, 2020, 10:41pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/5 "2020-11-24T22:41:35Z")

</div>

From a script onStartup of the main view.

---

<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:** [November 24, 2020, 10:46pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/6 "2020-11-24T22:46:55Z")

</div>

Try `self.session`? [https://docs.inductiveautomation.com/display/DOC81/Perspective+Component+Methods#PerspectiveComponentMethods-ObjectTraversal](https://docs.inductiveautomation.com/display/DOC81/Perspective+Component+Methods#PerspectiveComponentMethods-ObjectTraversal)

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [November 24, 2020, 10:53pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/7 "2020-11-24T22:53:02Z")

</div>

Maybe I have things out of order, cause I noticed the page came up for a second before authorization did. So I have the project go to a page and it has login then runs the script. Should I be doing this in a different order?Thx, jake

---

<div class="post-metadata">

**Author:** ![gmiroclosa](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gmiroclosa/32/21572_2.png) [@gmiroclosa](https://forum.inductiveautomation.com/u/gmiroclosa)\
**Post date:** [October 6, 2021, 4:35pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/8 "2021-10-06T16:35:52Z")

</div>

I could get logged username on a script in perspective with:  
**txtUserName = self.session.props.auth.user.userName**  
(like PGriffith saids)

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [January 20, 2022, 6:37pm UTC](https://forum.inductiveautomation.com/t/system-security-getusername-doesnt-work-in-perspective/40934/9 "2022-01-20T18:37:29Z")

</div>

Yeah, there’s certain places I can’t use it but was able to work around the limitation, thx
