Get User Details

Catalyst Authentication provides some methods to retrieve the details of the application users. You can obtain the user information of the current user, any user, or all users of the application.

Get Current User Details

The method getCurrentProjectUser() fetches the details of a user on whose scope the function is getting executed. The userManagement reference used in the code snippets is the component instance created earlier.

The promise returned here will be resolved to an object in which the content key contains the details of the current user of the application.

    
copy
//Get the details of the current user var userManagement = catalyst.userManagement; var currentUserPromise = userManagement.getCurrentProjectUser(); currentUserPromise .then((response) => { console.log(response.content); }) .catch((err) => { console.log(err); });

Additionally, you can also use the isUserAuthenticated() method which is an alternative to the getCurrentProjectUser() method.

    
copy
//Get the details of the current user var userManagement = catalyst.auth; var currentUserPromise = userManagement.isUserAuthenticated(); currentUserPromise .then((response) => { console.log(response.content); }) .catch((err) => { console.log(err); });

A sample response that you will receive for each version is shown below:

    
Web SDK
copy
{
zuid: "10062169698",
zaaid: "10062169862",
org_id: "10062169862",
status: "ACTIVE",
is_confirmed: false,
email_id: "amelia.burrows@zylker.com",
first_name: "Amelia",
last_name: "Burrows",
created_time: "Jul 05, 2023 10:30 AM",
modified_time: "Jul 05, 2023 10:30 AM",
invited_time: "Jul 05, 2023 10:30 AM",
role_details: {
role_name: "App Administrator",
role_id: "10103000000115014"
},
user_type: "App User",
user_id: "10103000000115057",
locale: "us|en_us|America/Los_Angeles",
time_zone: "America/Los_Angeles"
}
{
zuid: 1005641433,
zaaid: 1005641434,
org_id: 1005641434,
status: "ACTIVE",
is_confirmed: false,
email_id: "p.boyle@zylker.com",
last_name: "Boyle",
created_time: "Aug 12, 2021 12:27 PM",
role_details: { role_name: "App User", role_id: 2305000000006024 },
user_type: "App User",
user_id: 2305000000007745,
locale: "us|en|Asia/Kolkata",
time_zone: "Asia/Kolkata",
project_profiles: []
}

Last Updated 2023-12-19 19:06:47 +0530 +0530