redirectToCheckout
UserInformation类:
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
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()) {
String currentUserID = mAuth.getCurrentUser().getUid();
DataRef.child("Users").child(currentUserID).child("Name").setValue(name);
DataRef.child("Users").child(currentUserID).child("Email").setValue(email);
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user = mAuth.getCurrentUser();
updateUI();
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
// Toast.makeText(MainActivity.this, task.getException().getLocalizedMessage(), Toast.LENGTH_SHORT).show();
}
// ...
}
});
答案 0 :(得分:1)
首先分配Firebase用户。
FirebaseUser firebaseUser = mAuth.getCurrentUser();
将保留用户的数据。
有多种方法可以检索当前用户数据
String userEmail = firebaseUser.getEmail();
String uid = firebaseUser.getDisplayName();
String photouri = String.ValueOf(firebaseUser.getPhotoUrl());
答案 1 :(得分:0)
在'password: "something"'.replace(/(?<=password[ :]+)[^\n,]+/i, '*****')
中,您需要添加:
task.isSuccessful(){