# Logged In User Data

**URL:** https://meta.discourse.org/t/logged-in-user-data/304594
**Category:** Development
**Created:** [April 19, 2024, 9:40am UTC](https://meta.discourse.org/t/logged-in-user-data/304594 "2024-04-19T09:40:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [April 19, 2024, 9:40am UTC](https://meta.discourse.org/t/logged-in-user-data/304594/1 "2024-04-19T09:40:44Z")

</div>

Hello Discourse,

Can anyone help me to figure it out how can I get the logged in users data either in plugin or theme-component?

Thank you!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 19, 2024, 3:11pm UTC](https://meta.discourse.org/t/logged-in-user-data/304594/2 "2024-04-19T15:11:35Z")

</div>

What are you trying to do?

Do you want a list of the users that are logged in or to be able to tell what the currentUser is? Are you wanting to change something on the client side (in the browser) or server (rails?).

---

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [April 19, 2024, 3:32pm UTC](https://meta.discourse.org/t/logged-in-user-data/304594/3 "2024-04-19T15:32:47Z")

</div>

Hello @pfaffman,

Thanks for the response!

I want to change something on the client side and I want the details of currentUser.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [April 19, 2024, 3:39pm UTC](https://meta.discourse.org/t/logged-in-user-data/304594/4 "2024-04-19T15:39:43Z")

</div>

In a theme component, you can use the [API](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/lib/plugin-api.gjs):

`const currentUser = api.getCurrentUser();`

This is a global way to retrieve the current user data, but depending on your goal, you might need to do something different.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 19, 2024, 3:40pm UTC](https://meta.discourse.org/t/logged-in-user-data/304594/5 "2024-05-19T15:40:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
