Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sign in with different google account Firebase iOS

I am new to iOS and Firebase in general and I'm struggling to find out how I can get the app to show the google oAuth modal when I click the signin button. At the moment, it comes up on the first signup instance, but I have to delete the app to get it working again. This can be a bit cumbersome if someone wants to change google accounts.

// Google Sign In
@IBAction func gooSignInBtn(sender: AnyObject) {
    GIDSignIn.sharedInstance().signIn()
}

When I call sign out, it signs out, but the below modal doesn't show up again. It just automatically signs into the last signed in google account.

Does the try! FIRAuth.auth()!.signOut() function only sign out the member temporarily?

@IBAction func signOut(sender: AnyObject) {
            try! FIRAuth.auth()!.signOut()
            FIRAuth.auth()?.addAuthStateDidChangeListener({ (auth: FIRAuth, user: FIRUser?) in
                if let user = user {
                    // User is signed in.
                    print(user)
                } else {
                    // No user is signed in.
                    print("user signed out")
                }
            })
        }

enter image description here

like image 436
Clement Avatar asked Oct 18 '16 11:10

Clement


1 Answers

Try adding GIDSignIn.sharedInstance().signOut() for signout

like image 64
Olga Nesterenko Avatar answered Oct 21 '22 06:10

Olga Nesterenko