我如何驗證用戶已經註冊?我如何驗證用戶已經註冊?
private void firebaseAuthWithGoogle(final GoogleSignInAccount acct, final GoogleSignInResult result) {
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
//HOW CAN I validate user is already signup or not
if (Singup == true) {
did not create account.
} else {
create account;
}
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
Toast.makeText(Login.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
// updateUI(null);
}
}
});
}
請幫我解決這個問題。當用戶已經存在或不存在時,這是創建帳戶。
檢查更換
if (Singup == true) { // did not create account. } else { // create account; }
這篇文章:https://開頭計算器。 COM /問題/ 43030237 /火力檢查電子郵件註冊,如果登錄,通過-FAC ebook-and-google您可以使用Firebase數據庫跟蹤用戶是新用戶還是現有用戶。你將不得不建立這種機制。 – bojeil