users.checkLogin()

This method allows you to check if a username is valid. Preliminary information about the user will also be relayed.

Definition

client.users.checkLogin(
userId: string,
options: ?Object
):Promise<Object[]>

Parameters

ParameterTypeDescription
userIdstringAn email, username, or phone number
options?ObjectOptions (described below)

Options

ParameterTypeDescription
udidstringA unique identifier for the device

Returns

Once the returned Promise is resolved, we have access to an array of objects that have the following properties.

Each element in the array represents a server that the user has an account on.

The users property will contain an empty array if a valid account could not be found on any servers.

PropertyTypeDescription
base_urlstringThe corresponding API server where the account resides
email_checkObject[]A list of objects containing email information
idp_enabledbooleanIndicates if the user has MFA (Multi-factor Authentication) enabled
namestringThe geographical location of the server
usersObject[]A list of objects containing user information
validated_phone_numberbooleanIndicates if the account's phone number has been verified

Email Check

PropertyTypeDescription
blacklistedbooleanIndicates if the user's email address is black listed
domain_blockedbooleanIndicates if user's email address's domain is blocked
emailstringThe user's email address

User

PropertyTypeDescription
anonymousbooleanIndicates if the account is anonymous
display_namestringThe user's display name
emailsObject[]A list objects containing email information
ext_authbooleanIndicates if the user belongs to an organization that has external authentication enabled
first_namestringThe user's first name
last_loginstringThe timestamp of the last login time
local_authbooleanIndicates if the user is already logged in
organization_namesstring[]A list of organization names that the user is a part of
phonesObject[]A list of objects containing phone information
sms_numberstringThe phone number the sms message is sent to
sms_textstringThe sms message that is sent that contains the access code to secure the phone number
tokenstringThis account's token
device_validatedbooleanIndicates if the udid parameter is validated

Email

PropertyTypeDescription
addressstringThe email address
private_domainbooleanIndicates if the user attempted to login using an email domain that is blacklisted
validatedbooleanIndicates if the email is validated
validation_tokenstringA token that can be used to validate this email address

Phone

PropertyTypeDescription
numberstringThe phone number
validatedbooleanIndicates if the phone is validated
validation_tokenstringA token that can be used to validate this phone number

Example

const locations = await client.users.checkLogin('someone@email.com', {
udid: '3bc656cc-025b-49d1-aacf-ddf1b22a3a4b',
});
const isValidLogin = locations.some((location) => location.users.length > 0);
console.log(isValidLogin);