Render user information
Display signed-in user details in a browser interface.
Kinde · Function
getUser() returns the current user’s profile from the Kinde JavaScript client. Its result is a KindeUser, with profile fields typed as string | undefined.
getUser() reads the profile associated with the current user from the client. It returns a KindeUser, whose profile fields may be strings or undefined.
kinde.getUser();KindeUser
const user = kinde.getUser();
console.log(user);Reads the current user profile from the Kinde client.
Display signed-in user details in a browser interface.
Read profile data already available in the client session.
Inspect optional profile properties while building client-side logic.
getUser() return?getUser() returns the current user’s profile from the client and has the KindeUser type. Its profile fields can be string or undefined.
Follow-up: When should a freshly mapped profile be requested instead? Use the asynchronous getUserProfile() helper after session restoration or a redirect.
getUser()?Call the helper on the configured Kinde client: kinde.getUser(). The result represents the profile for the current user.
Follow-up: How can the result be used in an application? Read its profile properties, while accounting for fields that may be undefined.
getUser() differ from getUserProfile()?getUser() is the synchronous client helper for the current profile. getUserProfile() is asynchronous and is preferred when a freshly mapped profile is needed after session restoration.
Follow-up: What is the return type of the asynchronous alternative? It returns Promise<KindeUser | undefined>.
getUserProfileKindeUser