Java 类com.google.firebase.auth.GoogleAuthProvider 实例源码

项目:BuddiesGo    文件:SignInActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGooogle:" + acct.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(SignInActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    } else {
                        startActivity(new Intent(SignInActivity.this, MainActivity.class));
                        finish();
                    }
                }
            });
}
项目:friendlychat-android    文件:SignInActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(SignInActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    } else {
                        startActivity(new Intent(SignInActivity.this, MainActivity.class));
                        finish();
                    }
                }
            });
}
项目:School1-Android    文件:SigninActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == RC_SIGNIN_GOOGLE) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            GoogleSignInAccount account = result.getSignInAccount();
            AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
            auth.signInWithCredential(credential)
                    .addOnCompleteListener(this, this);
        } else
            onFailure(result.getStatus().toString());
    } else
        callbackManager.onActivityResult(requestCode, resultCode, data);
}
项目:Quadro    文件:AuthActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount account) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + account.getId());
    showProgressDialog();
    AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());
                    hideProgressDialog();
                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(AuthActivity.this, R.string.auth_failed,
                                Toast.LENGTH_SHORT).show();
                    }
                    // ...
                }
            });
}
项目:GodotFireBase    文件:GoogleSignIn.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {

        Utils.d("Google:FirebaseAuthWithGoogle:" + acct.getId());

        // FireBase.showProgressDialog();

        AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
        mAuth.signInWithCredential(credential)
        .addOnCompleteListener(activity, new OnCompleteListener<AuthResult>() {

            @Override
            public void onComplete(@NonNull Task<AuthResult> task) {
                Utils.d(
                "Google:SignInWithCredential:onComplete:" + task.isSuccessful());

                // If sign in fails, display a message to the user. If sign in succeeds
                // the auth state listener will be notified and logic to handle the
                // signed in user can be handled in the listener.
                if (!task.isSuccessful()) {
                    Utils.w("Google:SignInWithCredential:" + task.getException());
                }

                // FireBase.hideProgressDialog();
            }
        });
    }
项目:VR-One    文件:SignInActivity.java   
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) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(SignInActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                }
            });
}
项目:Viajes    文件:LoginPresenter.java   
@Override
public void firebaseAuthWithGoogle(final GoogleSignInAccount account) {
    final AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(mContext, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    mLoginView.dismissProgress();
                    if (!task.isSuccessful()) {
                        mLoginView.showErrorMessage("Error In Create User");
                    } else {
                        FirebaseAuth.getInstance().getCurrentUser().linkWithCredential(credential);
                        String uid = task.getResult().getUser().getUid();
                        String name = account.getDisplayName();
                        String email = account.getEmail();
                        String imageProfileUrl = getHighQualityImage(account.getPhotoUrl());
                        createUserInFirebaseHelper(uid, new User(name, email, imageProfileUrl));
                        mLoginView.showMain();
                    }
                }
            });
}
项目:BookED    文件:Authentication.java   
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) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(Authentication.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                    // ...
                }
            });
}
项目:friendlypix-android    文件:ProfileActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGooogle:" + acct.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    showProgressDialog(getString(R.string.profile_progress_message));
    mAuth.signInWithCredential(credential)
            .addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
                @Override
                public void onSuccess(AuthResult result) {
                    handleFirebaseAuthResult(result);
                }
            })
            .addOnFailureListener(this, new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    FirebaseCrash.logcat(Log.ERROR, TAG, "auth:onFailure:" + e.getMessage());
                    handleFirebaseAuthResult(null);
                }
            });
}
项目:cordova-plugin-firebase-sdk    文件:AuthCredentials.java   
public static AuthCredential getCredential(final JSONObject credential) throws Exception {
    final String providerId = credential.getString("provider");
    AuthCredential authCredential;

    if (providerId.equals(EmailAuthProvider.PROVIDER_ID)) {
        authCredential = getEmailAuthCredential(credential);
    } else if (providerId.equals(FacebookAuthProvider.PROVIDER_ID)) {
        authCredential = getFacebookAuthCredential(credential);
    } else if (providerId.equals(GithubAuthProvider.PROVIDER_ID)) {
        authCredential = getGithubAuthCredential(credential);
    } else if (providerId.equals(GoogleAuthProvider.PROVIDER_ID)) {
        authCredential = getGoogleAuthCredential(credential);
    } else if (providerId.equals(TwitterAuthProvider.PROVIDER_ID)) {
        authCredential = getTwitterAuthCredential(credential);
    } else {
        throw new Exception("Unknown provider ID: " + providerId);
    }

    return authCredential;
}
项目:PimPam    文件:LoginInteractorImpl.java   
@Override
public void firebaseAuthWithGoogle(GoogleSignInAccount acct,final OnLoginFinishedListener listener) {

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        listener.onLoginGoogleFail();
                    }

                }
            });
}
项目:FastReading    文件:AllBooks.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, task -> {
                if (!task.isSuccessful()) {
                    Toast.makeText(AllBooks.this, R.string.auth_error, Toast.LENGTH_SHORT).show();
                    signInSuccess = null;
                } else {
                    Toast.makeText(AllBooks.this, R.string.sign_in_ok, Toast.LENGTH_SHORT).show();

                    if (signInSignOut != null) {
                        if (mFirebaseAuth.getCurrentUser() != null) {
                            signInSignOut.setTitle(R.string.sign_out);
                        } else {
                            signInSignOut.setTitle(R.string.sign_in);
                        }
                    }

                    if (signInSuccess != null) {
                        signInSuccess.run();
                    }
                }
            });
}
项目:WaJeun    文件:MainActivity.java   
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) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(MainActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                    // ...
                }
            });
}
项目:CineReminDay    文件:CRDAuthActivity.java   
private void logInToFirebaseWithGoogleSignIn(GoogleSignInAccount googleSignInAccount) {
    Log.v(CRDAuthActivity.class.getName(), "logInToFirebaseWithGoogleSignIn() called with: " + "googleSignInAccount = [" + googleSignInAccount + "]");

    // TODO VOLKO MAKE USER WAIT

    AuthCredential credential = GoogleAuthProvider.getCredential(googleSignInAccount.getIdToken(), null);

    FirebaseAuth.getInstance()
            .signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.v(CRDAuthActivity.class.getName(), "logInToFirebaseWithGoogleSignIn.onComplete() called with: " + "isSuccessful = [" + task.isSuccessful() + "]");

                    // TODO VOLKO MAKE USER DE-WAIT

                    // If sign in succeeds the auth state listener will be notified and logic to handle the signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        onFirebaseConnectionFailed();
                    }
                }
            });
}
项目:trvlr-android    文件:LoginActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
    showProgressDialog();

    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()) {
                        // Sign in success, update UI with the signed-in user's information
                        Log.d(TAG, "signInWithCredential:success");
                        startActivity(new Intent(LoginActivity.this, FindConnectionActivity.class));
                        finish();
                    } else {
                        // If sign in fails, display a message to the user.
                        Log.w(TAG, "signInWithCredential:failure", task.getException());
                        Toast.makeText(LoginActivity.this, TAG + ": " + "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }

                    hideProgressDialog();
                }
            });
}
项目:Ae4Team    文件:LoginActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    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()) {
                        getUserInfo();
                    } else {
                        Log.w(TAG, "signInWithCredential:failure", task.getException());
                        Toast.makeText(LoginActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                }
            });
}
项目:PiPle    文件:LoginActivity.java   
/**
 * Method firebaseAuthWithGoogle
 *
 * Authenticates in Firebase through a Google Account.
 */
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(LoginActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                    else {
                        startActivity(new Intent(LoginActivity.this, HomeActivity.class));
                        finish();
                    }
                }
            });
}
项目:FantaF1    文件:LoginActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
    progress = ProgressDialog.show(this, "Login...",
            "", true);
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, task -> {
                if (task.isSuccessful()) {
                    currentUser =  mAuth.getCurrentUser();
                    Log.e(TAG, "signInWithCredential:success");
                    loadRooms();
                    updateUI(currentUser);
                } else {
                    Log.e(TAG, "signInWithCredential:failure", task.getException());
                    Toast.makeText(LoginActivity.this, "Authentication failed.",
                            Toast.LENGTH_SHORT).show();
                    updateUI(null);
                }
            });
}
项目:cleanarchitecture-unidirectional    文件:AuthService.java   
@Override
public Completable signInWithGoogle(final String token) {
    return Completable.create(e -> {
        final AuthCredential credential = GoogleAuthProvider.getCredential(token, null);
        auth.signInWithCredential(credential).addOnCompleteListener(task -> {
            if (!e.isDisposed()) {
                if (task.isSuccessful()) {
                    e.onComplete();
                } else {
                    if (task.getException() != null) {
                        e.onError(task.getException());
                    } else {
                        e.onError(new UnknownError());
                    }
                }
            }
        });
    });
}
项目:IdleCat    文件:SignInActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGooogle:" + acct.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(SignInActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    } else {
                        startActivity(new Intent(SignInActivity.this, MainActivity.class));
                        finish();
                    }
                }
            });
}
项目:cat-is-a-dog    文件:GoogleAuthenticator.java   
/**
 * Authenticate Google user with Firebase
 * @param acct Google account
 */
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(mContext, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        // Sign in success, update UI with the signed-in user's information
                        Log.d(TAG, "signInWithCredential:success");
                        onSuccess();
                    } else {
                        // If sign in fails, display a message to the user.
                        Log.w(TAG, "signInWithCredential:failure", task.getException());
                        onFailed();
                    }
                }
            });
}
项目:Expert-Android-Programming    文件:SignInBaseActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    MyLg.d(TAG, "firebaseAuthWithGoogle:" + acct.getId()+" "+acct.getPhotoUrl());
    showProgressDialog();

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    MyLg.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        MyLg.w(TAG, "signInWithCredential");
                        Toas.show(context, "Authentication failed.");
                    }
                    hideProgressDialog();
                }
            });
}
项目:Runnest    文件:LoginActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {

        FirebaseAuth.getInstance().signInWithCredential(GoogleAuthProvider.getCredential(acct.getIdToken(), null))
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if (task.isSuccessful()) {
                            startSideBarActivity();
                        } else {
                            // To always present the user the same login failure message and process we handle a
                            // firebase failure by simply prompting him to redo the whole authentication process.
                            loginFailed();
                        }
                    }
                });
    }
项目:Hyke    文件:LoginActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {

        AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
        auth.signInWithCredential(credential)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        Log.d("HERE", "signInWithCredential:onComplete:" + task.isSuccessful());
                        Intent intent = new Intent(getApplicationContext(), HomeActivity.class);
                        startActivity(intent);
                        finish();

                        // If sign in fails, display a message to the user. If sign in succeeds
                        // the auth state listener will be notified and logic to handle the
                        // signed in user can be handled in the listener.
                        if (!task.isSuccessful()) {
                            Log.w("HERE", "signInWithCredential", task.getException());
                            Toast.makeText(LoginActivity.this, "Authentication failed.",
                                    Toast.LENGTH_SHORT).show();
                        }
                    }
                });
    }
项目:Crimson    文件:SaveReports.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {

        Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());

        showProgressDialog();

        AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                        if (!task.isSuccessful()) {
                            Log.w(TAG, "signInWithCredential", task.getException());
                            Toast.makeText(SaveReports.this, "Authentication failed.",
                                    Toast.LENGTH_SHORT).show();
                        }
                        hideProgressDialog();
                    }
                });
    }
项目:Programmers    文件:UserRemoteDataSource.java   
@Override
public void firebaseAuthWithGoogle(GoogleSignInAccount account,
                                   final Callbacks.IResultCallback<Usuario> callback) {
    showLog("firebaseAuthWithGoogle: " + account.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
    FirebaseAuth.getInstance()
            .signInWithCredential(credential)
            .addOnFailureListener( reportError(callback))
            .addOnSuccessListener(new OnSuccessListener<AuthResult>() {
                @Override
                public void onSuccess(AuthResult authResult) {
                    FirebaseUser user = authResult.getUser();
                    loginFlow( user, callback);
                }
            });
}
项目:MangoBloggerAndroidApp    文件:BaseAuthActivity.java   
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()) {
                            hideProgressDialog();
                            // Sign in success, update UI with the signed-in user's information
                            Log.d(TAG, "signInWithCredential:success");
//                            FirebaseUser user = mAuth.getCurrentUser();
                            startApp();
                        } else {
                            hideProgressDialog();
                            // If sign in fails, display a message to the user.
                            Log.w(TAG, "signInWithCredential:failure", task.getException());
                            Toast.makeText(BaseAuthActivity.this, "Authentication failed.",
                                    Toast.LENGTH_SHORT).show();
                        }

                        // ...
                    }
                });
    }
项目:social-app-android    文件:LoginActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    LogUtil.logDebug(TAG, "firebaseAuthWithGoogle:" + acct.getId());
    showProgress();

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    LogUtil.logDebug(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        handleAuthError(task);
                    }
                }
            });
}
项目:FirebasePost    文件:RegisterActivity.java   
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()) {
                        // Sign in success, update UI with the signed-in user's information
                        Log.d(TAG, "signInWithCredential:success");
                        FirebaseUser user = mAuth.getCurrentUser();
                        printLog(TAG, "current user :" + user.getDisplayName());
                        updateUser(user);
                        updateUi();
                    } else {
                        // If sign in fails, display a message to the user.
                        Log.w(TAG, "signInWithCredential:failure", task.getException());
                        Toast.makeText(RegisterActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }

                    // ...
                }
            });
}
项目:chatRealAndroidFirebase    文件:SignInActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId()+acct.getIdToken());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(SignInActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    } else {
                        startActivity(new Intent(SignInActivity.this, MainActivity.class));
                        finish();
                    }
                }
            });
}
项目:IIFYM    文件:ActivitySelectAuthentication.java   
private void firebaseAuthWithGoogle(final GoogleSignInAccount acct) {
    Log.d("firebaseAuthWithGoogle", "Account ID " + acct.getId());

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    firebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        // Sign in success, update UI with the signed-in user's information
                        Log.d("signInWithCredential", "Success");
                        FirebaseUser user = firebaseAuth.getCurrentUser();
                        user.updateEmail(acct.getEmail());

                    } else {
                        // If sign in fails, display a message to the user.
                        Log.w("signInWithCredential", "Failed", task.getException());
                        Toast.makeText(ActivitySelectAuthentication.this, "Firebase authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                }
            });
}
项目:radiocom-android    文件:Authenticate.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
    avi.show();

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    if (task.isSuccessful()) {
                        // User is signed in, getAccount of Members
                        GetAccount getAccount = new GetAccount(mContext);
                        getAccount.execute();
                        Toast.makeText(Authenticate.this, R.string.auth_success, Toast.LENGTH_SHORT).show();
                    } else {
                        Log.d(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(Authenticate.this, R.string.auth_failed, Toast.LENGTH_SHORT).show();
                    }
                    avi.hide();
                }
            });
}
项目:survey-android    文件:LoginTempActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    auth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        Toast.makeText(LoginTempActivity.this, R.string.error_auth,
                                Toast.LENGTH_SHORT).show();
                        showMainScreen();
                    }else{
                        FirebaseUser firebaseUser = task.getResult().getUser();
                        User user = new User();
                        user.setDisplayName(firebaseUser.getDisplayName());
                        user.setEmail(firebaseUser.getEmail());
                        user.setId(firebaseUser.getUid());
                        if(firebaseUser.getPhotoUrl() != null){
                            user.setProfileImageURL(firebaseUser.getPhotoUrl().toString());
                        }
                        user.setToken(user.getToken());
                        repository.saveUser(user);
                        showMainScreen();
                    }
                }
            });
}
项目:survey-android    文件:LoginActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    auth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        Toast.makeText(LoginActivity.this, R.string.error_auth,
                                Toast.LENGTH_SHORT).show();
                        showMainScreen();
                    }else{
                        FirebaseUser firebaseUser = task.getResult().getUser();
                        User user = new User();
                        user.setDisplayName(firebaseUser.getDisplayName());
                        user.setEmail(firebaseUser.getEmail());
                        user.setId(firebaseUser.getUid());
                        if(firebaseUser.getPhotoUrl() != null){
                            user.setProfileImageURL(firebaseUser.getPhotoUrl().toString());
                        }
                        user.setToken(user.getToken());
                        repository.saveUser(user);
                        showMainScreen();
                    }
                }
            });
}
项目:jterm-cswithandroid    文件:SignInActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGooogle:" + acct.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(SignInActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    } else {
                        startActivity(new Intent(SignInActivity.this, MainActivity.class));
                        finish();
                    }
                }
            });
}
项目:Rubit    文件:LoginFragment.java   
/**
 * Firebase Auth With Google
 *
 * @param account GoogleSignInAccount
 */
private void firebaseAuthWithGoogle(GoogleSignInAccount account) {
    Log.d(TAG, "FirebaseAuthWithGoogle:" + account.getId());

    AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(getActivity(), task -> {
                ProgressDialogHelper.dismiss();

                Log.d(TAG, "[LOGIN_ACTIVITY] SignInWithCredential:onComplete:" + task.isSuccessful());
                // If sign in fails, display a message to the user. If sign in succeeds
                // the auth state listener will be notified and logic to handle the
                // signed in user can be handled in the listener.
                if (!task.isSuccessful()) {
                    Log.w(TAG, String.format("[LOGIN_ACTIVITY] SignInWithCredential:%s", task.getException()));
                    Toast.makeText(getActivity(), "Authentication Failed", Toast.LENGTH_LONG).show();
                } else {
                    createUserIfNotExists();
                }
            });
}
项目:LLAMA    文件:SignInActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
    showProgressDialog();

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(SignInActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                    hideProgressDialog();
                }
            });
}
项目:Firebase-Chat-Demo    文件:FirebaseAuthDatabase.java   
@Override
public Observable<Authentication> loginWithGoogle(final String idToken) {
    return Observable.create(new Observable.OnSubscribe<Authentication>() {
        @Override
        public void call(final Subscriber<? super Authentication> subscriber) {
            AuthCredential credential = GoogleAuthProvider.getCredential(idToken, null);
            firebaseAuth.signInWithCredential(credential)
                    .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                        @Override
                        public void onComplete(@NonNull Task<AuthResult> task) {
                            if (task.isSuccessful()) {
                                FirebaseUser firebaseUser = task.getResult().getUser();
                                subscriber.onNext(authenticationFrom(firebaseUser));
                            } else {
                                subscriber.onNext(new Authentication(task.getException()));
                            }
                            subscriber.onCompleted();
                        }
                    });
        }
    });
}
项目:Moto-Navigator    文件:AuthActivity.java   
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, getString(R.string.firebase_google) + acct.getId());
    showProgressDialog();

    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, getString(R.string.signInWithCredential_complete) + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, getString(R.string.signInWithCredential), task.getException());
                        Toast.makeText(AuthActivity.this, getString(R.string.authentication_failed),
                                Toast.LENGTH_SHORT).show();
                    }
                    // [START_EXCLUDE]
                    hideProgressDialog();
                    // [END_EXCLUDE]
                }
            });
}
项目:mvp-firebase    文件:LoginPresenter.java   
@Override
public void logInWithFirebase(GoogleSignInAccount account) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + account.getId());

    AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
    mFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener((Activity) mContext, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        mView.showFirebaseAuthenticationFailedMessage();

                    } else {
                        mView.startChatListActivity();
                    }
                }
            });
}