User

AV. User

An AV.User object is a local representation of a user persisted to the LeanCloud server. This class is a subclass of an AV.Object, and retains the same functionality of an AV.Object, but also extends it with various user specific methods, like authentication, signing up, and validation of uniqueness.

Constructor

new User()

Source:

Methods

(static) _genId()

Source:
Only use for DI in tests to produce deterministic IDs.

(static) become(sessionToken) → {Promise}

Source:
Logs in a user with a session token. On success, this saves the session to disk, so you can retrieve the currently logged in user using current.
Parameters:
Name Type Description
sessionToken String The sessionToken to log in with.
Returns:
A promise that is fulfilled with the user when the login completes.
Type
Promise

(static) changePhoneNumber(mobilePhoneNumber, code) → {Promise}

Source:
Since:
  • 4.7.0
Makes a call to reset user's account mobilePhoneNumber by sms code. The sms code is sent by AV.User.requestChangePhoneNumber
Parameters:
Name Type Description
mobilePhoneNumber String
code String The sms code.
Returns:
Type
Promise

(static) current() → {AV.User}

Source:
Retrieves the currently logged in AVUser with a valid session, either from memory or localStorage, if necessary.
Returns:
The currently logged in AV.User.
Type
AV.User

(static) currentAsync() → {Promise.<AV.User>}

Source:
Retrieves the currently logged in AVUser with a valid session, either from memory or localStorage, if necessary.
Returns:
resolved with the currently logged in AV.User.
Type
Promise.<AV.User>

(static) followeeQuery(userObjectId) → {AV.FriendShipQuery}

Source:
Since:
  • 0.3.0
Create a followee query for special user to query the user's followees.
Parameters:
Name Type Description
userObjectId String The user object id.
Returns:
Type
AV.FriendShipQuery

(static) followerQuery(userObjectId) → {AV.FriendShipQuery}

Source:
Since:
  • 0.3.0
Create a follower query for special user to query the user's followers.
Parameters:
Name Type Description
userObjectId String The user object id.
Returns:
Type
AV.FriendShipQuery

(static) logIn(username, password) → {Promise}

Source:
See:
Logs in a user with a username (or email) and password. On success, this saves the session to disk, so you can retrieve the currently logged in user using current.
Parameters:
Name Type Description
username String The username (or email) to log in with.
password String The password to log in with.
Returns:
A promise that is fulfilled with the user when the login completes.
Type
Promise

(static) loginAnonymously() → {Promise.<AV.User>}

Source:
Since:
  • 3.9.0
Creates an anonymous user.
Returns:
Type
Promise.<AV.User>

(static) loginWithAuthData(authData, platform, optionsopt) → {Promise}

Source:
Since:
  • 3.7.0
See:
Signs up or logs in a user with a third party auth data(AccessToken). On success, this saves the session to disk, so you can retrieve the currently logged in user using current.
Example
AV.User.loginWithAuthData({
  openid: 'abc123',
  access_token: '123abc',
  expires_in: 1382686496
}, 'weixin').then(function(user) {
  //Access user here
}).catch(function(error) {
  //console.error("error: ", error);
});
Parameters:
Name Type Attributes Description
authData Object The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
platform string Available platform for sign up.
options Object <optional>
Properties
Name Type Attributes Description
failOnNotExist boolean <optional>
If true, the login request will fail when no user matches this authData exists.
Returns:
A promise that is fulfilled with the user when the login completes.
Type
Promise

(static) loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 3.7.0
Signs up or logs in a user with a third party authData and unionId.
Example
AV.User.loginWithAuthDataAndUnionId({
  openid: 'abc123',
  access_token: '123abc',
  expires_in: 1382686496
}, 'weixin', 'union123', {
  unionIdPlatform: 'weixin',
  asMainAccount: true,
}).then(function(user) {
  //Access user here
}).catch(function(error) {
  //console.error("error: ", error);
});
Parameters:
Name Type Attributes Description
authData Object The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
platform string Available platform for sign up.
unionId string
unionLoginOptions Object <optional>
Properties
Name Type Attributes Default Description
unionIdPlatform string <optional>
'weixin' unionId platform
asMainAccount boolean <optional>
false If true, the unionId will be associated with the user.
failOnNotExist boolean <optional>
If true, the login request will fail when no user matches this authData exists.
Returns:
A promise that is fulfilled with the user when completed.
Type
Promise.<AV.User>

(static) loginWithEmail(email, password) → {Promise}

Source:
Since:
  • 3.13.0
Logs in a user with email and password.
Parameters:
Name Type Description
email String The user's email.
password String The password to log in with.
Returns:
A promise that is fulfilled with the user when the login completes.
Type
Promise

(static) loginWithMiniApp(authInfo, optionopt)

Source:
Register or login using the identity of the current mini-app.
Parameters:
Name Type Attributes Description
authInfo Object
option Object <optional>
Properties
Name Type Attributes Description
failOnNotExist Boolean <optional>
If true, the login request will fail when no user matches this authInfo.authData exists.

(static) logInWithMobilePhone(mobilePhone, password) → {Promise}

Source:
See:
Logs in a user with a mobile phone number and password. On success, this saves the session to disk, so you can retrieve the currently logged in user using current.
Parameters:
Name Type Description
mobilePhone String The user's mobilePhoneNumber
password String The password to log in with.
Returns:
A promise that is fulfilled with the user when the login completes.
Type
Promise

(static) logInWithMobilePhoneSmsCode(mobilePhone, smsCode) → {Promise}

Source:
See:
Logs in a user with a mobile phone number and sms code sent by AV.User.requestLoginSmsCode.On success, this saves the session to disk, so you can retrieve the currently logged in user using current.
Parameters:
Name Type Description
mobilePhone String The user's mobilePhoneNumber
smsCode String The sms code sent by AV.User.requestLoginSmsCode
Returns:
A promise that is fulfilled with the user when the login completes.
Type
Promise

(static) loginWithQQApp(optionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 4.2.0
Deprecated:
使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。 仅在 QQ 小程序中可用。
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Default Description
preferUnionId boolean <optional>
如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
unionIdPlatform string <optional>
'qq' (only take effect when preferUnionId) unionId platform
asMainAccount boolean <optional>
true (only take effect when preferUnionId) If true, the unionId will be associated with the user.
failOnNotExist boolean <optional>
If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
Returns:
Type
Promise.<AV.User>

(static) loginWithQQAppWithUnionId(unionLoginOptionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 4.2.0
Deprecated:
使用当前使用 QQ 小程序的 QQ 用户身份注册或登录, 仅在 QQ 小程序中可用。
Parameters:
Name Type Attributes Description
unionLoginOptions Object <optional>
Properties
Name Type Attributes Default Description
unionIdPlatform string <optional>
'qq' unionId platform
asMainAccount boolean <optional>
false If true, the unionId will be associated with the user.
failOnNotExist boolean <optional>
If true, the login request will fail when no user matches this authData exists.
Returns:
Type
Promise.<AV.User>

(static) loginWithWeapp(optionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 2.0.0
Deprecated:
使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。 仅在微信小程序中可用。
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Default Description
preferUnionId boolean <optional>
当用户满足 获取 UnionId 的条件 时,是否使用 UnionId 登录。(since 3.13.0)
unionIdPlatform string <optional>
'weixin' (only take effect when preferUnionId) unionId platform
asMainAccount boolean <optional>
true (only take effect when preferUnionId) If true, the unionId will be associated with the user.
failOnNotExist boolean <optional>
If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
Returns:
Type
Promise.<AV.User>

(static) loginWithWeappWithUnionId(unionLoginOptionsopt)

Source:
Since:
  • 3.13.0
Deprecated:
使用当前使用微信小程序的微信用户身份注册或登录, 仅在微信小程序中可用。
Parameters:
Name Type Attributes Description
unionLoginOptions Object <optional>
Properties
Name Type Attributes Default Description
unionIdPlatform string <optional>
'weixin' unionId platform
asMainAccount boolean <optional>
false If true, the unionId will be associated with the user.
failOnNotExist boolean <optional>
If true, the login request will fail when no user matches this authData exists. * @return {Promise.}

(static) logOut() → {Promise}

Source:
Logs out the currently logged in user session. This will remove the session from disk, log out of linked services, and future calls to current will return null.
Returns:
Type
Promise

(static) mergeUnionId(authInfo, unionId, unionIdOptionopt)

Source:
Since:
  • 4.6.0
Merge unionId into authInfo.
Parameters:
Name Type Attributes Description
authInfo Object
unionId String
unionIdOption Object <optional>
Properties
Name Type Attributes Description
asMainAccount Boolean <optional>
If true, the unionId will be associated with the user.

(static) requestChangePhoneNumber(mobilePhoneNumber, ttlopt, optionsopt) → {Promise}

Source:
Since:
  • 4.7.0
Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber. This sms code allows current user to reset it's mobilePhoneNumber by calling AV.User.changePhoneNumber
Parameters:
Name Type Attributes Description
mobilePhoneNumber String
ttl Number <optional>
ttl of sms code (default is 6 minutes)
options SMSAuthOptions <optional>
Returns:
Type
Promise

(static) requestEmailVerify(email) → {Promise}

Source:
Requests a verify email to be sent to the specified email address associated with the user account. This email allows the user to securely verify their email address on the AV site.
Parameters:
Name Type Description
email String The email address associated with the user that doesn't verify their email address.
Returns:
Type
Promise

(static) requestLoginSmsCode(mobilePhoneNumber, optionsopt) → {Promise}

Source:
Requests a logIn sms code to be sent to the specified mobile phone number associated with the user account. This sms code allows the user to login by AV.User.logInWithMobilePhoneSmsCode function.
Parameters:
Name Type Attributes Description
mobilePhoneNumber String The mobile phone number associated with the user that want to login by AV.User.logInWithMobilePhoneSmsCode
options SMSAuthOptions <optional>
Returns:
Type
Promise

(static) requestMobilePhoneVerify(mobilePhoneNumber, optionsopt) → {Promise}

Source:
Requests a verify sms code to be sent to the specified mobile phone number associated with the user account. This sms code allows the user to verify their mobile phone number by calling AV.User.verifyMobilePhone
Parameters:
Name Type Attributes Description
mobilePhoneNumber String The mobile phone number associated with the user that doesn't verify their mobile phone number.
options SMSAuthOptions <optional>
Returns:
Type
Promise

(static) requestPasswordReset(email) → {Promise}

Source:
Requests a password reset email to be sent to the specified email address associated with the user account. This email allows the user to securely reset their password on the AV site.
Parameters:
Name Type Description
email String The email address associated with the user that forgot their password.
Returns:
Type
Promise

(static) requestPasswordResetBySmsCode(mobilePhoneNumber, optionsopt) → {Promise}

Source:
Requests a reset password sms code to be sent to the specified mobile phone number associated with the user account. This sms code allows the user to reset their account's password by calling AV.User.resetPasswordBySmsCode
Parameters:
Name Type Attributes Description
mobilePhoneNumber String The mobile phone number associated with the user that doesn't verify their mobile phone number.
options SMSAuthOptions <optional>
Returns:
Type
Promise

(static) resetPasswordBySmsCode(code, password) → {Promise}

Source:
Makes a call to reset user's account password by sms code and new password. The sms code is sent by AV.User.requestPasswordResetBySmsCode.
Parameters:
Name Type Description
code String The sms code sent by AV.User.Cloud.requestSmsCode
password String The new password.
Returns:
A promise that will be resolved with the result of the function.
Type
Promise

(static) signUp(username, password, attrsopt, optionsopt) → {Promise}

Source:
See:
Signs up a new user with a username (or email) and password. This will create a new AV.User on the server, and also persist the session in localStorage so that you can access the user using #current.
Parameters:
Name Type Attributes Description
username String The username (or email) to sign up with.
password String The password to sign up with.
attrs Object <optional>
Extra fields to set on the new user.
options AuthOptions <optional>
Returns:
A promise that is fulfilled with the user when the signup completes.
Type
Promise

(static) signUpOrlogInWithAuthData()

Source:
Deprecated:

(static) signUpOrlogInWithAuthDataAndUnionId()

Source:
Since:
  • 3.5.0
Deprecated:

(static) signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attributes, options) → {Promise}

Source:
See:
Signs up or logs in a user with a mobilePhoneNumber and smsCode. On success, this saves the session to disk, so you can retrieve the currently logged in user using current.
Parameters:
Name Type Description
mobilePhoneNumber String The user's mobilePhoneNumber.
smsCode String The sms code sent by AV.Cloud.requestSmsCode
attributes Object The user's other attributes such as username etc.
options AuthOptions
Returns:
A promise that is fulfilled with the user when the login completes.
Type
Promise

(static) verifyMobilePhone(code) → {Promise}

Source:
Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode If verify successfully,the user mobilePhoneVerified attribute will be true.
Parameters:
Name Type Description
code String The sms code sent by AV.User.Cloud.requestSmsCode
Returns:
A promise that will be resolved with the result of the function.
Type
Promise

associateWithAuthData(authData, platform) → {Promise.<AV.User>}

Source:
Since:
  • 3.3.0
Associate the user with a third party authData.
Example
user.associateWithAuthData({
  openid: 'abc123',
  access_token: '123abc',
  expires_in: 1382686496
}, 'weixin').then(function(user) {
  //Access user here
}).catch(function(error) {
  //console.error("error: ", error);
});
Parameters:
Name Type Description
authData Object The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
platform string Available platform for sign up.
Returns:
A promise that is fulfilled with the user when completed.
Type
Promise.<AV.User>

associateWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 3.5.0
Associate the user with a third party authData and unionId.
Example
user.associateWithAuthDataAndUnionId({
  openid: 'abc123',
  access_token: '123abc',
  expires_in: 1382686496
}, 'weixin', 'union123', {
  unionIdPlatform: 'weixin',
  asMainAccount: true,
}).then(function(user) {
  //Access user here
}).catch(function(error) {
  //console.error("error: ", error);
});
Parameters:
Name Type Attributes Description
authData Object The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
platform string Available platform for sign up.
unionId string
unionLoginOptions Object <optional>
Properties
Name Type Attributes Default Description
unionIdPlatform string <optional>
'weixin' unionId platform
asMainAccount boolean <optional>
false If true, the unionId will be associated with the user.
Returns:
A promise that is fulfilled with the user when completed.
Type
Promise.<AV.User>

associateWithMiniApp(authInfoopt, optionopt) → {Promise.<AV.User>}

Source:
Since:
  • 4.6.0
Associate the user with the identity of the current mini-app.
Parameters:
Name Type Attributes Description
authInfo Object <optional>
option Object <optional>
Properties
Name Type Attributes Description
failOnNotExist Boolean <optional>
If true, the login request will fail when no user matches this authInfo.authData exists.
Returns:
Type
Promise.<AV.User>

associateWithQQApp(optionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 4.2.0
Deprecated:
将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。 仅在 QQ 小程序中可用。
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Default Description
preferUnionId boolean <optional>
false 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
unionIdPlatform string <optional>
'qq' (only take effect when preferUnionId) unionId platform
asMainAccount boolean <optional>
true (only take effect when preferUnionId) If true, the unionId will be associated with the user.
Returns:
Type
Promise.<AV.User>

associateWithQQAppWithUnionId(unionId, unionOptionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 4.2.0
Deprecated:
将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。 仅在 QQ 小程序中可用。
Parameters:
Name Type Attributes Description
unionId string
unionOptions Object <optional>
Properties
Name Type Attributes Default Description
unionIdPlatform string <optional>
'qq' unionId platform
asMainAccount boolean <optional>
false If true, the unionId will be associated with the user.
Returns:
Type
Promise.<AV.User>

associateWithWeapp(optionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 3.13.0
Deprecated:
将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。 仅在微信小程序中可用。
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Default Description
preferUnionId boolean <optional>
false 当用户满足 获取 UnionId 的条件 时,是否将 UnionId 保存在用户账号中。
unionIdPlatform string <optional>
'weixin' (only take effect when preferUnionId) unionId platform
asMainAccount boolean <optional>
true (only take effect when preferUnionId) If true, the unionId will be associated with the user.
Returns:
Type
Promise.<AV.User>

associateWithWeappWithUnionId(unionId, unionOptionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 3.13.0
Deprecated:
将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。 仅在微信小程序中可用。
Parameters:
Name Type Attributes Description
unionId string
unionOptions Object <optional>
Properties
Name Type Attributes Default Description
unionIdPlatform string <optional>
'weixin' unionId platform
asMainAccount boolean <optional>
false If true, the unionId will be associated with the user.
Returns:
Type
Promise.<AV.User>

authenticated()

Source:
Deprecated:
  • 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(), 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
Checks whether this user is the current user and has been authenticated.
Returns:
(Boolean) whether this user is the current user and is logged in.

dissociateAuthData(platform) → {Promise.<AV.User>}

Source:
Since:
  • 3.3.0
Unlinks a user from a service.
Parameters:
Name Type Description
platform string
Returns:
Type
Promise.<AV.User>

fetch()

Source:
See:

follow(options, authOptionsopt)

Source:
Since:
  • 0.3.0
Follow a user
Parameters:
Name Type Attributes Description
options Object | AV.User | String if an AV.User or string is given, it will be used as the target user.
Properties
Name Type Attributes Description
user AV.User | String The target user or user's objectId to follow.
attributes Object <optional>
key-value attributes dictionary to be used as conditions of followerQuery/followeeQuery.
authOptions AuthOptions <optional>

followeeQuery()

Source:
Since:
  • 0.3.0
See:
Create a followee query to query the user's followees.

followerQuery()

Source:
Since:
  • 0.3.0
See:
Create a follower query to query the user's followers.

getEmail() → {String}

Source:
See:
Returns get("email").
Returns:
Type
String

getFollowersAndFollowees(optionsopt, authOptionsopt)

Source:
Since:
  • 4.8.0
Get the user's followers and followees.
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Description
skip Number <optional>
limit Number <optional>
authOptions AuthOptions <optional>

getMobilePhoneNumber() → {String}

Source:
See:
Returns get("mobilePhoneNumber").
Returns:
Type
String

getRoles(optionsopt) → {Promise.<Array.<AV.Role>>}

Source:
Get this user's Roles.
Parameters:
Name Type Attributes Description
options AuthOptions <optional>
Returns:
A promise that is fulfilled with the roles when the query is complete.
Type
Promise.<Array.<AV.Role>>

getSessionToken() → {String}

Source:
Get sessionToken of current user.
Returns:
sessionToken
Type
String

getUsername() → {String}

Source:
See:
Returns get("username").
Returns:
Type
String

isAnonymous() → {boolean}

Source:
Since:
  • 3.9.0
Checks whether a user is anonymous.
Returns:
Type
boolean

isAuthenticated()

Source:
Since:
  • 2.0.0
Detects if current sessionToken is valid.
Returns:
Promise.

isCurrent()

Source:
See:
  • AV.User#current
Returns true if current would return this user.

linkWithWeapp() → {Promise.<AV.User>}

Source:
Deprecated:
Returns:
Type
Promise.<AV.User>

logIn() → {Promise}

Source:
See:
Logs in a AV.User. On success, this saves the session to localStorage, so you can retrieve the currently logged in user using current.

A username and password must be set before calling logIn.

Returns:
A promise that is fulfilled with the user when the login is complete.
Type
Promise

loginWithAuthData()

Source:
Since:
  • 3.7.0
The same with AV.User.loginWithAuthData, except that you can set attributes before login.

loginWithAuthDataAndUnionId()

Source:
Since:
  • 3.7.0
The same with AV.User.loginWithAuthDataAndUnionId, except that you can set attributes before login.

loginWithMiniApp()

Source:
Since:
  • 4.6.0
The same with AV.User.loginWithMiniApp, except that you can set attributes before login.

loginWithQQApp(optionsopt)

Source:
Since:
  • 4.2.0
Deprecated:
The same with AV.User.loginWithQQApp, except that you can set attributes before login.
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Default Description
failOnNotExist boolean <optional>
If true, the login request will fail when no user matches this authData exists.
preferUnionId boolean <optional>
如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
unionIdPlatform string <optional>
'qq' (only take effect when preferUnionId) unionId platform
asMainAccount boolean <optional>
true (only take effect when preferUnionId) If true, the unionId will be associated with the user.

loginWithQQAppWithUnionId()

Source:
Since:
  • 4.2.0
Deprecated:
The same with AV.User.loginWithQQAppWithUnionId, except that you can set attributes before login.

loginWithWeapp(optionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 3.7.0
Deprecated:
The same with AV.User.loginWithWeapp, except that you can set attributes before login.
Parameters:
Name Type Attributes Description
options Object <optional>
Properties
Name Type Attributes Default Description
failOnNotExist boolean <optional>
If true, the login request will fail when no user matches this authData exists.
preferUnionId boolean <optional>
当用户满足 获取 UnionId 的条件 时,是否使用 UnionId 登录。(since 3.13.0)
unionIdPlatform string <optional>
'weixin' (only take effect when preferUnionId) unionId platform
asMainAccount boolean <optional>
true (only take effect when preferUnionId) If true, the unionId will be associated with the user.
Returns:
Type
Promise.<AV.User>

loginWithWeappWithUnionId()

Source:
Since:
  • 3.13.0
Deprecated:
The same with AV.User.loginWithWeappWithUnionId, except that you can set attributes before login.

refreshSessionToken(optionsopt) → {Promise.<AV.User>}

Source:
Since:
  • 2.1.0
Refresh sessionToken of current user.
Parameters:
Name Type Attributes Description
options AuthOptions <optional>
Returns:
user with refreshed sessionToken
Type
Promise.<AV.User>

save()

Source:
See:

setEmail(email, options) → {Boolean}

Source:
See:
Calls set("email", email, options) and returns the result.
Parameters:
Name Type Description
email String
options AuthOptions
Returns:
Type
Boolean

setMobilePhoneNumber(mobilePhoneNumber) → {Boolean}

Source:
See:
Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
Parameters:
Name Type Description
mobilePhoneNumber String
Returns:
Type
Boolean

setPassword(password) → {Boolean}

Source:
See:
Calls set("password", password, options) and returns the result.
Parameters:
Name Type Description
password String
Returns:
Type
Boolean

setUsername(username) → {Boolean}

Source:
See:
Calls set("username", username, options) and returns the result.
Parameters:
Name Type Description
username String
Returns:
Type
Boolean

signUp(attrs, options) → {Promise}

Source:
See:
Signs up a new user. You should call this instead of save for new AV.Users. This will create a new AV.User on the server, and also persist the session on disk so that you can access the user using current.

A username and password must be set before calling signUp.

Parameters:
Name Type Description
attrs Object Extra fields to set on the new user, or null.
options AuthOptions
Returns:
A promise that is fulfilled when the signup finishes.
Type
Promise

signUpOrlogInWithMobilePhone(attrs, options) → {Promise}

Source:
See:
Signs up a new user with mobile phone and sms code. You should call this instead of save for new AV.Users. This will create a new AV.User on the server, and also persist the session on disk so that you can access the user using current.

A username and password must be set before calling signUp.

Parameters:
Name Type Description
attrs Object Extra fields to set on the new user, or null.
options AuthOptions
Returns:
A promise that is fulfilled when the signup finishes.
Type
Promise

unfollow(options, authOptionsopt)

Source:
Since:
  • 0.3.0
Unfollow a user.
Parameters:
Name Type Attributes Description
options Object | AV.User | String if an AV.User or string is given, it will be used as the target user.
Properties
Name Type Description
user AV.User | String The target user or user's objectId to unfollow.
authOptions AuthOptions <optional>

updatePassword(oldPassword, newPassword, options)

Source:
Update user's new password safely based on old password.
Parameters:
Name Type Description
oldPassword String the old password.
newPassword String the new password.
options AuthOptions