# Get current username / Session in scripting in perspective

**URL:** <https://forum.inductiveautomation.com/t/get-current-username-session-in-scripting-in-perspective/47778>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 15, 2021, 11:53am UTC](https://forum.inductiveautomation.com/t/get-current-username-session-in-scripting-in-perspective/47778 "2021-06-15T11:53:41Z")\
**Posts on this page:** 1\
**Showing post:** 9

<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:** [June 15, 2021, 4:09pm UTC](https://forum.inductiveautomation.com/t/get-current-username-session-in-scripting-in-perspective/47778/9 "2021-06-15T16:09:14Z")

</div>

The ugly, hacky, unsupported, completely-liable-to-break-on-any-upgrade way to get magical access to the current session is using a public static ThreadLocal, as mentioned here:

> [@SDK transfert data from gateway to perspective](http://forum.inductiveautomation.com/t/sdk-transfert-data-from-gateway-to-perspective/36349/18):
>
> If you’re calling the InternalSession.SESSION threadlocal directly, then you don’t need to go through the rest of the Perspective context - you can directly call whatever you want to - ie, InternalSession.SESSION.get().getEventBus().post(); Also, a healthy disclaimer that while it’s unlikely we’ll change things, the InternalSession threadlocal is not considered part of our API surface, so it could break in some future version without notice.

As my first sentence alludes - this is a bad practice, liable to break at any time.

---

_[View the full topic](https://forum.inductiveautomation.com/t/get-current-username-session-in-scripting-in-perspective/47778)._
