client.signIn()

This method allows you to sign in using a user ID and password.

Definition

client.signIn(
userId: string,
password: string,
options: ?Object
):Promise<Session,Error>

Parameters

ParameterTypeDescription
userIdstringAn email, username, or phone number
passwordstringThe user's password
options?ObjectOptions (described below)

Options

ParameterTypeDescription
refreshUser?booleanIndicates whether to fetch the user's latest information during sign in (default: true)
udidstringA unique identifier for the device

If you elect to call this method with refreshUser set to false, make sure to do a client.users.findMe({ bypassCache: true }) call later to fully load the current user.

Returns

An error will be thrown if any of the arguments are invalid.

Otherwise, once the returned Promise is resolved, we will have access to an object containing authentication and user information.

PropertyTypeDescription
authObjectAuthentication details
userObjectPartial User with some fields missing

Auth

PropertyTypeDescription
keystringAn authentication key
secretstringAn authentication secret
resourcestringThe generated resource token

Examples

const { user } = await client.signIn(
'someone@email.com',
's3cr3t',
{
udid: '3bc656cc-025b-49d1-aacf-ddf1b22a3a4b'
}
);
console.log(user.displayName);