Home>

I am creating an authentication screen with Google, Facebook, E-mail using Firebase Authentication
I am creating a transition screen using Storyboard
The flow is that when you press the authentication button, authViewController is displayed, and if you can log in, you will move to the next screen.

If i press the Cancel button that appears on the authentication screen and scroll from top to bottom, you will be able to reach the next screen without logging in.

Corresponding source code
import UIKit
import Firebase
import Firebase UI
import FirebaseAuth
import GoogleSignIn
class PeripheralSigninViewController: UIViewController, FUIAuthDelegate {
    @IBOutlet weak var authButton: UIButton!
    var authUI: FUIAuth {get {return FUIAuth.defaultAuthUI ()!}}
    let providers: [FUIAuthProvider] = [
        FUIGoogleAuth (),
        FUIFacebookAuth (),
        FUIEmailAuth ()
    ]
    override func viewDidLoad () {
        super.viewDidLoad ()
        self.authUI.delegate = self
                self.authUI.providers = providers
                authButton.addTarget (self, action: #selector (self.authButtonTapped (sender :)), for: .touchUpInside)
    }
    @objc func authButtonTapped (sender: AnyObject) {
        // Get View of Firebase UI
        let authViewController = self.authUI.authViewController ()
        // Display View of Firebase UI
        self.present (authViewController, animated: true, completion: nil)
    }
    public func authUI (_ authUI: FUIAuth, didSignInWith user: User ?, error: Error?) {
        // If authentication is successful
        if error == nil {
            self.performSegue (withIdentifier: "PeripheralViewController", sender: nil)
        } else {
        // If it fails
            print ("error")
        }
    }
}
Question

I'm not sure if there is a problem with segues or Sent Event or with the source code

  • Answer # 1

    Pressing the Cancel button or flicking from top to bottom closes the modal by default.
    I think it's not "reaching the next screen" but "returning to the previous screen", but this is also a specification.