使用不同的Google帐户Firebase iOS登录 [英] Sign in with different google account Firebase iOS

查看:256
本文介绍了使用不同的Google帐户Firebase iOS登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS和Firebase的新手,我很难找到如何在点击登录按钮时让应用程序显示google oAuth模式。目前,它出现在第一个注册实例上,但我必须删除该应用程序以使其再次运行。如果有人想要更改谷歌帐户,这可能有点麻烦。

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.

是否尝试! FIRAuth.auth()!。signOut()函数只能暂时退出会员?

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")
                }
            })
        }

推荐答案

尝试添加 GIDSignIn.sharedInstance()。signOut()注销

这篇关于使用不同的Google帐户Firebase iOS登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆