API Docs for:

Class Parse.User

Parse.User( )
_cleanupAuthData( )

Removes null values from authData (which exist temporarily for unlinking)

_isLinked( )

Checks whether a user is linked to a service.

_linkWith( )

Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can call linkWith on the user (even if it doesn't exist yet on the server).

_logOutWith( )

Deauthenticates a single provider (e.g. removing access tokens from the Facebook SDK).

_logOutWithAll( )

Deauthenticates all providers.

_synchronizeAllAuthData( )

Synchronizes authData for all providers.

_synchronizeAuthData( )

Synchronizes auth data for a provider (e.g. puts the access token in the right place to be used by the Facebook SDK).

_unlinkFrom( )

Unlinks a user from a service.

Parse.Promise _upgradeToRevocableSession( options )

Request a revocable session token to replace the older style of token.

Parameters:
  • options <Object>

    A Backbone-style options object.


Returns: <Parse.Promise>

A promise that is resolved when the replacement token has been fetched.

allowCustomUserClass( isAllowed )

Allow someone to define a custom User class without className being rewritten to _User. The default behavior is to rewrite User to _User for legacy reasons. This allows developers to override that behavior.

Parameters:
  • isAllowed <Boolean>

    Whether or not to allow custom User class

authenticated( )

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.

Parse.Promise become( sessionToken, options )

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.

Calls options.success or options.error on completion.

Parameters:
  • sessionToken <String>

    The sessionToken to log in with.

  • options <Object>

    A Backbone-style options object.


Returns: <Parse.Promise>

A promise that is fulfilled with the user when the login completes.

Parse.Object current( )

Retrieves the currently logged in ParseUser with a valid session, either from memory or localStorage, if necessary.


Returns: <Parse.Object>

The currently logged in Parse.User.

Parse.Promise currentAsync( )

Retrieves the currently logged in ParseUser from asynchronous Storage.


Returns: <Parse.Promise>

A Promise that is resolved with the currently logged in Parse User

disableUnsafeCurrentUser( )

Disables the use of become or the current user in any environment. These features are disabled on servers by default, since they depend on global objects that are not memory-safe for most servers.

Parse.Promise enableRevocableSession( options )

Allows a legacy application to start using revocable sessions. If the current session token is not revocable, a request will be made for a new, revocable session. It is not necessary to call this method from cloud code unless you are handling user signup or login from the server side. In a cloud code call, this function will not attempt to upgrade the current token.

Parameters:
  • options <Object>

    A Backbone-style options object.


Returns: <Parse.Promise>

A promise that is resolved when the process has completed. If a replacement session token is requested, the promise will be resolved after a new token has been fetched.

enableUnsafeCurrentUser( )

Enables the use of become or the current user in a server environment. These features are disabled by default, since they depend on global objects that are not memory-safe for most servers.

Class extend( protoProps, classProps )

Adds functionality to the existing Parse.User class

Parameters:
  • protoProps <Object>

    A set of properties to add to the prototype

  • classProps <Object>

    A set of static properties to add to the class


Returns: <Class>

The newly extended Parse.User class

String getEmail( )

Returns get("email").


Returns: <String>
String getSessionToken( )

Returns the session token for this user, if the user has been logged in, or if it is the result of a query with the master key. Otherwise, returns undefined.


Returns: <String>

the session token, or undefined

String getUsername( )

Returns get("username").


Returns: <String>
Boolean isCurrent( )

Returns true if current would return this user.


Returns: <Boolean>
Parse.Promise logIn( options )

Logs in a Parse.User. On success, this saves the session to disk, so you can retrieve the currently logged in user using current.

A username and password must be set before calling logIn.

Calls options.success or options.error on completion.

Parameters:
  • options <Object>

    A Backbone-style options object.


Returns: <Parse.Promise>

A promise that is fulfilled with the user when the login is complete.

Parse.Promise logIn( username, password, options )

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.

Calls options.success or options.error on completion.

Parameters:
  • username <String>

    The username (or email) to log in with.

  • password <String>

    The password to log in with.

  • options <Object>

    A Backbone-style options object.


Returns: <Parse.Promise>

A promise that is fulfilled with the user when the login completes.

Parse.Promise logOut( )

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: <Parse.Promise>

A promise that is resolved when the session is destroyed on the server.

requestPasswordReset( email, options )

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 Parse site.

Calls options.success or options.error on completion.

Parameters:
  • email <String>

    The email address associated with the user that forgot their password.

  • options <Object>

    A Backbone-style options object.

Boolean setEmail( email, options )

Calls set("email", email, options) and returns the result.

Parameters:
  • email <String>
  • options <Object>

    A Backbone-style options object.


Returns: <Boolean>
Boolean setPassword( password, options )

Calls set("password", password, options) and returns the result.

Parameters:
  • password <String>
  • options <Object>

    A Backbone-style options object.


Returns: <Boolean>
Boolean setUsername( username, options )

Calls set("username", username, options) and returns the result.

Parameters:
  • username <String>
  • options <Object>

    A Backbone-style options object.


Returns: <Boolean>
Parse.Promise signUp( username, password, attrs, options )

Signs up a new user with a username (or email) and password. This will create a new Parse.User on the server, and also persist the session in localStorage so that you can access the user using {@link #current}.

Calls options.success or options.error on completion.

Parameters:
  • username <String>

    The username (or email) to sign up with.

  • password <String>

    The password to sign up with.

  • attrs <Object>

    Extra fields to set on the new user.

  • options <Object>

    A Backbone-style options object.


Returns: <Parse.Promise>

A promise that is fulfilled with the user when the signup completes.

Parse.Promise signUp( attrs, options )

Signs up a new user. You should call this instead of save for new Parse.Users. This will create a new Parse.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.

Calls options.success or options.error on completion.

Parameters:
  • attrs <Object>

    Extra fields to set on the new user, or null.

  • options <Object>

    A Backbone-style options object.


Returns: <Parse.Promise>

A promise that is fulfilled when the signup finishes.