# Page Startup Event - Get Current User

**URL:** <https://forum.inductiveautomation.com/t/page-startup-event-get-current-user/40373>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 5, 2020, 8:51pm UTC](https://forum.inductiveautomation.com/t/page-startup-event-get-current-user/40373 "2020-11-05T20:51:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott.stamps](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@scott.stamps](https://forum.inductiveautomation.com/u/scott.stamps)\
**Post date:** [November 5, 2020, 8:51pm UTC](https://forum.inductiveautomation.com/t/page-startup-event-get-current-user/40373/1 "2020-11-05T20:51:15Z")

</div>

Is it possible to get the current user’s user id/name from within the Page Startup event? Without a reference to self or session, I’ve not been able to. Thanks.

 ![Screenshot 2020-11-05 144546](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/c/4c45d4c2474a659f185a6bff915610431a482552.png)

---

<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 6, 2020, 3:47pm UTC](https://forum.inductiveautomation.com/t/page-startup-event-get-current-user/40373/2 "2020-11-06T15:47:27Z")

</div>

`page.session` should still work (despite the somewhat misleading docstring) - from there, you can access whatever else you need from the session.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 6, 2020, 4:11pm UTC](https://forum.inductiveautomation.com/t/page-startup-event-get-current-user/40373/3 "2020-11-06T16:11:16Z")

</div>

If you read really carefully in the [docs](https://docs.inductiveautomation.com/display/DOC81/Perspective+Session+Event+Scripts#PerspectiveSessionEventScripts-StartupandShutdownEventScripts#PerspectiveSessionEventScripts-PageStartup) you’ll find that there is indeed a session object attached to the `page` object provided. you can use this to get the current user:

```auto
# note that the session object is a direct child of the page object
# while accessing pageId or path requires a step into the props
# of page, ie: page.props.pageId
username = page.session.props.auth.user.username

```

---

<div class="post-metadata">

**Author:** ![scott.stamps](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@scott.stamps](https://forum.inductiveautomation.com/u/scott.stamps)\
**Post date:** [November 6, 2020, 4:39pm UTC](https://forum.inductiveautomation.com/t/page-startup-event-get-current-user/40373/4 "2020-11-06T16:39:08Z")

</div>

So - I _had_ tried this, but was seeing an empty user object:

{“firstName”:null,“lastName”:null,“roles”:null,“id”:null,“userName”:null,“email”:null,“timestamp”:null}

However, this project (which is a simple test project on our new 8.1 demo server), had its Permissions set to ‘Public’ instead of ‘Authenticated’… which caused the user object to be empty. 🤦‍♂️

Thanks guys.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 6, 2020, 4:40pm UTC](https://forum.inductiveautomation.com/t/page-startup-event-get-current-user/40373/5 "2020-11-06T16:40:32Z")

</div>

Correct - if the user isn’t logged in then there would be no user/username in place for the current Page.
