system.security.getUsername doesn't work in perspective

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

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

1 Like

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

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

From a script onStartup of the main view.

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

1 Like

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

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