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
Parameter | Type | Description |
---|
userId | string | An email, username, or phone number |
options | ?Object | Options (described below) |
Options
Parameter | Type | Description |
---|
udid | string | A 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.
Property | Type | Description |
---|
base_url | string | The corresponding API server where the account resides |
email_check | Object[] | A list of objects containing email information |
idp_enabled | boolean | Indicates if the user has MFA (Multi-factor Authentication) enabled |
name | string | The geographical location of the server |
users | Object[] | A list of objects containing user information |
validated_phone_number | boolean | Indicates if the account's phone number has been verified |
Email Check
Property | Type | Description |
---|
blacklisted | boolean | Indicates if the user's email address is black listed |
domain_blocked | boolean | Indicates if user's email address's domain is blocked |
email | string | The user's email address |
User
Property | Type | Description |
---|
anonymous | boolean | Indicates if the account is anonymous |
display_name | string | The user's display name |
emails | Object[] | A list objects containing email information |
ext_auth | boolean | Indicates if the user belongs to an organization that has external authentication enabled |
first_name | string | The user's first name |
last_login | string | The timestamp of the last login time |
local_auth | boolean | Indicates if the user is already logged in |
organization_names | string[] | A list of organization names that the user is a part of |
phones | Object[] | A list of objects containing phone information |
sms_number | string | The phone number the sms message is sent to |
sms_text | string | The sms message that is sent that contains the access code to secure the phone number |
token | string | This account's token |
device_validated | boolean | Indicates if the udid parameter is validated |
Email
Property | Type | Description |
---|
address | string | The email address |
private_domain | boolean | Indicates if the user attempted to login using an email domain that is blacklisted |
validated | boolean | Indicates if the email is validated |
validation_token | string | A token that can be used to validate this email address |
Phone
Property | Type | Description |
---|
number | string | The phone number |
validated | boolean | Indicates if the phone is validated |
validation_token | string | A 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);