Last updated

getAuthenticatedUser()

Gets the currently authenticated user, if any.

Signature

const user = window.FairShareSDK.getAuthenticatedUser();

Returns

User | null — The authenticated user object, or null if no user is authenticated.

User Object:

PropertyTypeDescription
idnumberUser ID
namestringUser's display name
emailstringUser's email address
avatar_urlstringURL to user's avatar image

Example

const user = window.FairShareSDK.getAuthenticatedUser();

if (user) {
  console.log('User ID:', user.id);
  console.log('Name:', user.name);
  console.log('Email:', user.email);
} else {
  console.log('No user authenticated');
}