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

项目:GodotFireBase    文件:FacebookSignIn.java   
public void handleAccessToken(AccessToken token) {
    Utils.d("FB:Handle:AccessToken: " + token.getToken());
    // showProgressDialog();

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());

    mAuth.signInWithCredential(credential)
    .addOnCompleteListener(activity, new OnCompleteListener<AuthResult>() {

        @Override
        public void onComplete(@NonNull Task<AuthResult> task) {
            Utils.d("FB: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("FB:signInWithCredential" + 
                    task.getException().toString());
            }

            // hideProgressDialog();
        }
    });
}
项目: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;
}
项目:android-paypal-example    文件:LoginActivity.java   
private void handleFacebookAccessToken(AccessToken token) {

        Log.d(TAG, "handleFacebookAccessToken:" + token);

        AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
        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");
                            updateUI(mAuth.getCurrentUser());
                        } else {
                            // If sign in fails, display a message to the user.
                            Log.w(TAG, "signInWithCredential:failure", task.getException());
                            Toast.makeText(LoginActivity.this, "Authentication failed.",
                                    Toast.LENGTH_SHORT).show();
                        }

                    }
                });
    }
项目:WaJeun    文件:MainActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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();
                    }

                    // ...
                }
            });
}
项目:Stalker    文件:AuthenticateFragment.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    fireBaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(getActivity(), 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(getApplicationContext(), "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                }
            });
}
项目:CollegeDoc    文件:MainActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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();
                    }
                }
            });
}
项目:CollegeDoc    文件:MainActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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();
                    }
                }
            });
}
项目:social-app-android    文件:LoginActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    LogUtil.logDebug(TAG, "handleFacebookAccessToken:" + token);
    showProgress();

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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 handleFacebookAccessToken(AccessToken token) {
    Log.e(TAG, "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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.e(TAG, "signInWithCredential:success");
                        FirebaseUser user = mAuth.getCurrentUser();
                        updateUser(user);
                        updateUi();
                    } else {
                        // If sign in fails, display a message to the user.
                        Log.e(TAG, "signInWithCredential:failure", task.getException());
                        Toast.makeText(RegisterActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }

                    // ...
                }

            });
}
项目:Project-Chao    文件:AuthDialogFragment.java   
private void handleFacebookAccessToken(AccessToken token) {
  Log.d(TAG, "handleFacebookAccessToken:" + token);
  // [START_EXCLUDE silent]
  // showProgressDialog();
  // [END_EXCLUDE]
  AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
  mAuth.signInWithCredential(credential)
      .addOnCompleteListener(getActivity(), 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(getContext(), "Authentication failed.", Toast.LENGTH_SHORT).show();
          }
          // [START_EXCLUDE]
          // hideProgressDialog();
          dismiss();
          // [END_EXCLUDE]
        }
      });
}
项目:survey-android    文件:LoginTempActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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 handleFacebookAccessToken(AccessToken token) {
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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();
                    }
                }
            });
}
项目:survey-android    文件:RegisterActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d("hfat", "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    auth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d("hfat - o", "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("hfat - o is", "signInWithCredential", task.getException());
                        Toast.makeText(RegisterActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }

                    // ...
                }
            });
}
项目:MikuyConcept    文件:LoginPresenter.java   
@Override
public void onSuccess(LoginResult loginResult) {
    Timber.d("facebook:onSuccess:permissions" + loginResult.getRecentlyGrantedPermissions());
    AuthCredential credential = FacebookAuthProvider.getCredential(loginResult.getAccessToken().getToken());
    firebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        Timber.d("onComplete:failed:" + task.getException());
                        return;
                    }
                    Timber.d("onComplete:success:" + task.isSuccessful());
                    sessionManager.saveUserInfo();
                    setupLoginState();
                }
            });
}
项目:Stalker    文件:AuthenticateFragment.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    fireBaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(getActivity(), 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(getApplicationContext(), "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                }
            });
}
项目:flavordex    文件:SettingsActivity.java   
@Override
protected Void doInBackground(Void... voids) {
    final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
    if(user != null) {
        for(UserInfo info : user.getProviderData()) {
            switch(info.getProviderId()) {
                case GoogleAuthProvider.PROVIDER_ID:
                    logoutGoogle();
                    break;
                case FacebookAuthProvider.PROVIDER_ID:
                    logoutFacebook();
                    break;
                case TwitterAuthProvider.PROVIDER_ID:
                    logoutTwitter();
                    break;
            }
        }
        FirebaseAuth.getInstance().signOut();
    }
    return null;
}
项目:react-native-firestack    文件:FirestackAuth.java   
@ReactMethod
public void facebookLogin(String Token, final Callback callback) {
    mAuth = FirebaseAuth.getInstance();

    AuthCredential credential = FacebookAuthProvider.getCredential(Token);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                  if (task.isSuccessful()) {
                      FirestackAuthModule.this.user = task.getResult().getUser();
                      userCallback(FirestackAuthModule.this.user, callback);
                  }else{
                      // userErrorCallback(task, callback);
                  }
                }
            }).addOnFailureListener(new OnFailureListener() {
          @Override
          public void onFailure(@NonNull Exception ex) {
            userExceptionCallback(ex, callback);
          }
        });
}
项目:FastFoodFinder    文件:LoginActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    FirebaseClient.getInstance().getAuth().signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d("MAPP", "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("MAPP", "signInWithCredential", task.getException());
                        Toast.makeText(LoginActivity.this, R.string.authentication_failed,
                                Toast.LENGTH_SHORT).show();
                    } else {
                        isAuthenticated = true;
                        Toast.makeText(LoginActivity.this, R.string.sign_in_successfully, Toast.LENGTH_SHORT).show();
                    }
                }
            });
}
项目:FirebaseAuthExample    文件:LoginPresenter.java   
void handleFacebookAccessToken(AccessToken token) {
    mView.showProgress();
    Timber.d("handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener((Activity) mContext, task -> {
                mView.hideProgress();

                Timber.d("signInWithCredential:onComplete:" + task.isSuccessful());

                if (!task.isSuccessful()) {
                    Timber.w("signInWithFbCredential", task.getException());
                    mEventBus.post(new LoginEvent(false, "Fb Auth Failed : " + task.getException().getMessage()));
                } else {
                    Timber.w("signInWithFbCredential", "success with email " + task.getResult().getUser().getEmail());
                    mEventBus.post(new LoginEvent(true, "Fb Auth Success"));
                }
            });
}
项目:The_Elucidated    文件:SignInLoadActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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(SignInLoadActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }
                    // ...
                }
            });
}
项目:FirebaseUI-Android    文件:ProviderUtils.java   
/**
 * Translate a Firebase Auth provider ID (such as {@link GoogleAuthProvider#PROVIDER_ID}) to a
 * Credentials API account type (such as {@link IdentityProviders#GOOGLE}).
 */
public static String providerIdToAccountType(@AuthUI.SupportedProvider @NonNull String providerId) {
    switch (providerId) {
        case GoogleAuthProvider.PROVIDER_ID:
            return IdentityProviders.GOOGLE;
        case FacebookAuthProvider.PROVIDER_ID:
            return IdentityProviders.FACEBOOK;
        case TwitterAuthProvider.PROVIDER_ID:
            return IdentityProviders.TWITTER;
        case PhoneAuthProvider.PROVIDER_ID:
            return PHONE_IDENTITY;
        // The account type for email/password creds is null
        case EmailAuthProvider.PROVIDER_ID:
        default:
            return null;
    }
}
项目:FirebaseUI-Android    文件:AuthMethodPickerActivityTest.java   
@Test
@Config(shadows = {AuthHelperShadow.class, AuthHelperShadow.class})
public void testFacebookLoginFlow() {
    // initialize mocks
    reset(AuthHelperShadow.getSaveSmartLockInstance(null));

    when(AuthHelperShadow.getCurrentUser().getProviders())
            .thenReturn(Arrays.asList(FacebookAuthProvider.PROVIDER_ID));
    when(AuthHelperShadow.getFirebaseAuth().signInWithCredential((AuthCredential) any()))
            .thenReturn(new AutoCompleteTask<>(FakeAuthResult.INSTANCE, true, null));

    List<String> providers = Arrays.asList(AuthUI.FACEBOOK_PROVIDER);

    AuthMethodPickerActivity authMethodPickerActivity = createActivity(providers);

    Button facebookButton = authMethodPickerActivity.findViewById(R.id.facebook_button);
    assertNotNull(facebookButton);
    facebookButton.performClick();

    verifySmartLockSave(AuthUI.FACEBOOK_PROVIDER, TestConstants.EMAIL, null);
}
项目:Quadro    文件:AuthActivity.java   
private void handleFacebookAccessToken(AccessToken accessToken) {
    showProgressDialog();

    AuthCredential credential = FacebookAuthProvider.getCredential(accessToken.getToken());
    mAuth.signInWithCredential(credential).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
        @Override
        public void onComplete(@NonNull Task<AuthResult> task) {
            if (!task.isSuccessful()) {
                Toast.makeText(getApplicationContext(), R.string.firebase_error_login, Toast.LENGTH_LONG).show();
            }
            hideProgressDialog();
        }
    });
}
项目:pracler    文件:Splash.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d("Facebook", "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    firebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d("Facebook", "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("Facebook", "signInWithCredential", task.getException());
                    }
                    prepare();

                    /* 신규인지 확인 */
                    if (isNetworkConnected())
                    {
                        checkNewUser();
                    }

                    onMainActivity();
                }
            });
}
项目:FeedFire    文件:FacebookSign.java   
private void handleFacebookAccessToken(AccessToken token) {
    FirebaseAuth auth = FirebaseAuth.getInstance();
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    auth.signInWithCredential(credential)
            .addOnCompleteListener(mActivity, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        mFaceCallback.cancelLoginFace();
                    }else{
                       mFaceCallback.getInfoFace();
                    }
                }
            });
}
项目:firebase-chat-android-architecture-components    文件:ProfileActivity.java   
private void firebaseAuthWithFacebook(AccessToken token) {
    Timber.e("firebaseAuthWithFacebook:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, mAuthCompleteListener);
}
项目:Ae4Team    文件:LoginActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        getUserInfo();
                    } else {
                        // If sign in fails, display a message to the user.
                        Toast.makeText(LoginActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show();
                    }
                }
            });
}
项目:Expert-Android-Programming    文件:SignInBaseActivity.java   
private void handleFacebookAccessToken(final AccessToken token) {
    MyLg.d("KOI", "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener((Activity) context, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    MyLg.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                }
            });
}
项目:social-app-android    文件:LogoutHelper.java   
private static void logoutByProvider(String providerId, GoogleApiClient mGoogleApiClient, FragmentActivity fragmentActivity) {
    switch (providerId) {
        case GoogleAuthProvider.PROVIDER_ID:
            logoutGoogle(mGoogleApiClient, fragmentActivity);
            break;

        case FacebookAuthProvider.PROVIDER_ID:
            logoutFacebook(fragmentActivity.getApplicationContext());
            break;
    }
}
项目:social-journal    文件:LoginActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    if (mAuth.getCurrentUser() == null) {
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(LoginActivity.this, new LoginCallback(LoginActivity.this, false, "connect_to_facebook"));
    } else {
        mAuth.getCurrentUser()
                .linkWithCredential(credential)
                .addOnCompleteListener(LoginActivity.this, new LoginCallback(LoginActivity.this, true, "connect_to_facebook"));
    }
}
项目:social-journal    文件:SettingsActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    if (mAuth.getCurrentUser() == null) {
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(this, new LoginCallback(this, false, "connect_to_facebook"));
    } else {
        mAuth.getCurrentUser()
                .linkWithCredential(credential)
                .addOnCompleteListener(this, new LoginCallback(this, true, "connect_to_facebook"));
    }
}
项目:directly    文件:Authorizer.java   
private void handleFacebookAccessToken(AccessToken token) {
    Timber.d(TAG, "handleFacebookAccessToken:" + token);

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    firebaseAuth.signInWithCredential(credential).addOnCompleteListener(task -> {
        authListener.onSignIn();
    });
}
项目:Project-Chao    文件:AuthActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
  Log.d(TAG, "handleFacebookAccessToken:" + token);
  // [START_EXCLUDE silent]
  // showProgressDialog();
  // [END_EXCLUDE]
  AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
  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(AuthActivity.this, "Authentication failed.", Toast.LENGTH_SHORT)
                .show();
          }
          // [START_EXCLUDE]
          // hideProgressDialog();
          startActivity(new Intent(AuthActivity.this, TimelineActivity.class));
          finish();
          // [END_EXCLUDE]
        }
      });
}
项目:quickstart-android    文件:FacebookLoginActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);
    // [START_EXCLUDE silent]
    showProgressDialog();
    // [END_EXCLUDE]

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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();
                        updateUI(user);
                    } else {
                        // If sign in fails, display a message to the user.
                        Log.w(TAG, "signInWithCredential:failure", task.getException());
                        Toast.makeText(FacebookLoginActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                        updateUI(null);
                    }

                    // [START_EXCLUDE]
                    hideProgressDialog();
                    // [END_EXCLUDE]
                }
            });
}
项目:sabbath-school-android    文件:SSLoginViewModel.java   
private void handleFacebookAccessToken(AccessToken token) {
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    ssFirebaseAuth.signInWithCredential(credential)
            .addOnCompleteListener((SSLoginActivity)context, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        loginFailed(task.getException().getMessage());
                    }
                }
            });
}
项目:endpoints-samples    文件:FacebookLoginActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    Log.d(TAG, "handleFacebookAccessToken:" + token);
    // [START_EXCLUDE silent]
    showProgressDialog();
    // [END_EXCLUDE]

    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    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(FacebookLoginActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                    }

                    // [START_EXCLUDE]
                    hideProgressDialog();
                    // [END_EXCLUDE]
                }
            });
}
项目:FindMeAHome    文件:SignUpFragment.java   
private void handleFacebookAccessToken(AccessToken token) {
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    firebaseAuth.signInWithCredential(credential).addOnCompleteListener(getActivity(), 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(getActivity(), R.string.error_registration,
                        Toast.LENGTH_SHORT).show();
                getActivity().finish();
            } else {
                registerUserInDatabase();
                if (listener != null) {
                    Bundle bundle = new Bundle();
                    listener.onFragmentInteraction(Constants.SIGN_UP_FRAGMENT, bundle);
                } else {
                    getActivity().finish();
                }
            }
        }
    });
}
项目:Firebase-Login-Example-Project    文件:MainActivity.java   
private void handleFacebookAccessToken(AccessToken token) {
    AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
    auth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        signInStatusMessage("Facebook authentication failed.");
                        signOut();
                    }
                }
            });
}
项目:react-native-firestack    文件:FirestackAuth.java   
@ReactMethod
public void reauthenticateWithCredentialForProvider(final String provider, final String authToken, final String authSecret, final Callback callback) {
    AuthCredential credential;

    if (provider.equals("facebook")) {
        credential = FacebookAuthProvider.getCredential(authToken);
    } else if (provider.equals("google")) {
        credential = GoogleAuthProvider.getCredential(authToken, null);
    } else if (provider.equals("twitter")) {
        credential = TwitterAuthProvider.getCredential(authToken, authSecret);
    } else {
        // TODO:
        FirestackUtils.todoNote(TAG, "reauthenticateWithCredentialForProvider", callback);
        // AuthCredential credential;
        // Log.d(TAG, "reauthenticateWithCredentialForProvider called with: " + provider);
        return;
    }

    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
    if (user != null) {
        user.reauthenticate(credential)
            .addOnCompleteListener(new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    if (task.isSuccessful()) {
                        Log.d(TAG, "User re-authenticated with " + provider);
                        FirebaseUser u = FirebaseAuth.getInstance().getCurrentUser();
                        userCallback(u, callback);
                    } else {
                        // userErrorCallback(task, callback);
                    }
                }
            });
    } else {
        WritableMap err = Arguments.createMap();
        err.putInt("errorCode", NO_CURRENT_USER);
        err.putString("errorMessage", "No current user");
        callback.invoke(err);
    }
}
项目:FirebaseUI-Android    文件:FacebookProvider.java   
private void onSuccess(LoginResult loginResult,
                       @Nullable String email,
                       String name,
                       Uri photoUri) {
    gcCallbackManager();
    mCallbackObject.onSuccess(new IdpResponse.Builder(
            new User.Builder(FacebookAuthProvider.PROVIDER_ID, email)
                    .setName(name)
                    .setPhotoUri(photoUri)
                    .build())
            .setToken(loginResult.getAccessToken().getToken())
            .build());
}