Thursday, August 6, 2015

Logging In a User

JAVA

ParseUser.logInInBackground("johndoe", "p@ssw0rd", new LogInCallback() {
    public void done(ParseUser user, ParseException e) {
        if (user != null) {
            // User has logged in successfully.
        } else {
            // Error! Access the "e" variable to find out what.
        }
    }
});

SWIFT

PFUser.logInWithUsernameInBackground("johndoe", password:"p@ssw0rd") {
  (user: PFUser?, error: NSError?) -> Void in
  if user != nil {
    // Do stuff after successful login.
  } else {
    // The login failed. Check "error" variable to see why.
  }

}

1 comment: