Logged In User Data

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!

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?).

2 Likes

Hello @pfaffman,

Thanks for the response!

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

In a theme component, you can use the API:

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.

2 Likes