Logged-in user context
The API allows retrieving the context of the user currently filling out the form. The context describes users logged in on the form, in the Dashboard application, or in client applications integrated with the Eximee system, as well as information about the session of a user who is not logged in.
User API (api.user.v1)
A universal interface that precisely describes users across all access channels (logged in via Web, via the Dashboard application, in integrated systems, and unauthenticated users).
User identity structure (UserIdentity)
Method api.user.v1.getIdentity() returns an object representing the current identity. The table below describes its default, most commonly encountered properties:
userId
String
Unique user identifier.
username
String
User name intended for display.
roles
Array<String>
List of roles assigned to the user as an array of strings (e.g. ["EXIMEE_BROKER", "USER"]).
firstName
String
User's first name.
lastName
String
User's last name.
type
String
Authentication type. Returns one of the values: 'client' (client), 'employee' (employee) or 'otp' (one-time password).
system
String
Identifier of the system providing authentication.
interface User {
v1: {
getIdentity(): UserIdentity
}
}
interface UserIdentity {
userId(): string,
username(): string,
roles(): string[],
firstName(): string,
lastName(): string,
type(): 'client'|'employee'|'otp',
system(): string
}Retrieving user data
Example of using the User API with role validation
The following script retrieves the user's identity, checks whether they have the appropriate role to perform the action, and if not, throws a business exception and stops execution.
Last updated
Was this helpful?
