SHARE
TWEET

Code-Example-Jett

a guest Dec 13th, 2016 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @IBAction func signInTapped(_ sender: AnyObject) {
  2.        
  3.         if let email = emailField.text, let pwd = pwdField.text {
  4.             FIRAuth.auth()?.signIn(withEmail: email, password: pwd, completion: { (user, error) in
  5.                 if error == nil {
  6.                     print("JETT: Email user authenticated with Firebase")
  7.                     if let user = user {
  8.                         let userData = ["provider": user.providerID,
  9.                                         "uid": user.uid]
  10.                         self.completeSignIn(id: user.uid, userData: userData)
  11.                     }
  12.                 } else {
  13.                     FIRAuth.auth()?.createUser(withEmail: email, password: pwd, completion: { (user, error) in
  14.                         if error != nil {
  15.                             print("JETT: Unable to authenticate with Firebase using email")
  16.                         } else {
  17.                             print("JETT: Successfully Authenticated with Firebase")
  18.                             if let user = user {
  19.                                 let userData = ["provider": user.providerID,
  20.                                                 "uid": user.uid]
  21.                                 self.completeSignIn(id: user.uid, userData: userData)
  22.                             }
  23.                         }
  24.                     })
  25.                 }
  26.             })
  27.         }
  28.        
  29.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top