getUserDetails()
Othent JS SDK getUserDetails() function
Returns an object with all the user details (UserDetails
) of the active (authenticated) user account.
The value you get when calling getUserDetails()
or when subscribing to the auth
event before authenticating by calling connect()
or requireAuth()
(either manually or automatically by setting autoConnect = "eager"
), will be (in this order of priority):
The value you pass as
initialUserDetails
, if any.The value stored in
localStorage
, if you setpersistLocalStorage
.null
otherwise.
@othent/kms
does not performs any type of validation when reading the user details from these sources, and therefore you should treat that data as untrusted and make sure you sanitize it appropriately.
Failing to do that could result in your application being vulnerable to XSS if an attacker manages to tamper with these values.
API
return Promise<UserDetails | null>
return Promise<UserDetails | null>
A Promise
containing all the user details of the active user, or null
if the user is not authenticated.
Example usage
Last updated