【发布时间】:2021-02-22 12:45:36
【问题描述】:
我正在使用Firebase Google Authentication 服务。身份验证工作正常,但问题是当我使用 google auth 登录时,凭据会被保存。因此,每次注销后,我都无法选择登录电子邮件。它直接让我登录到应用程序。因此,当我想使用另一个 Gmail 帐户登录时,这对我来说就成了一个问题。
实现凭证页面的代码。
google_sign_in_btn.setOnClickListener {
signIn()
}
...
private fun signIn() {
val signInIntent = mGoogleSignInClient.signInIntent
startActivityForResult(signInIntent, 234)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == 234)
{
val task = GoogleSignIn.getSignedInAccountFromIntent(data)
try
{
val account = task.getResult(ApiException::class.java)
if (account != null) {
firebaseAuthWithGoogle(account)
}
}
catch (e:ApiException) {
}
}
}
【问题讨论】:
标签: android firebase kotlin firebase-authentication google-authentication