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
Parameter | Type | Description |
---|---|---|
userId | string | An email, username, or phone number |
password | string | The user's password |
options | ?Object | Options (described below) |
Options
Parameter | Type | Description |
---|---|---|
refreshUser | ?boolean | Indicates whether to fetch the user's latest information during sign in (default: true ) |
udid | string | A 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.
Property | Type | Description |
---|---|---|
auth | Object | Authentication details |
user | Object | Partial User with some fields missing |
Auth
Property | Type | Description |
---|---|---|
key | string | An authentication key |
secret | string | An authentication secret |
resource | string | The generated resource token |
Examples
const { user } = await client.signIn('someone@email.com','s3cr3t',{udid: '3bc656cc-025b-49d1-aacf-ddf1b22a3a4b'});console.log(user.displayName);