当前位置: 首页>>代码示例>>Java>>正文


Java FacebookAuthProvider类代码示例

本文整理汇总了Java中com.google.firebase.auth.FacebookAuthProvider的典型用法代码示例。如果您正苦于以下问题:Java FacebookAuthProvider类的具体用法?Java FacebookAuthProvider怎么用?Java FacebookAuthProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FacebookAuthProvider类属于com.google.firebase.auth包,在下文中一共展示了FacebookAuthProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
                    }
                }
            });
}
 
开发者ID:Shobhit-pandey,项目名称:CollegeDoc,代码行数:20,代码来源:MainActivity.java

示例2: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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);
                    }
                }
            });
}
 
开发者ID:rozdoum,项目名称:social-app-android,代码行数:21,代码来源:LoginActivity.java

示例3: handleAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
		}
	});
}
 
开发者ID:FrogSquare,项目名称:GodotFireBase,代码行数:27,代码来源:FacebookSignIn.java

示例4: getCredential

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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;
}
 
开发者ID:jsayol,项目名称:cordova-plugin-firebase-sdk,代码行数:21,代码来源:AuthCredentials.java

示例5: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
                        }

                    }
                });
    }
 
开发者ID:OmarAliSaid,项目名称:android-paypal-example,代码行数:24,代码来源:LoginActivity.java

示例6: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
                    }

                    // ...
                }
            });
}
 
开发者ID:othreecodes,项目名称:WaJeun,代码行数:24,代码来源:MainActivity.java

示例7: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
                    }
                }
            });
}
 
开发者ID:Pavou,项目名称:Stalker,代码行数:20,代码来源:AuthenticateFragment.java

示例8: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
                    }

                    // ...
                }

            });
}
 
开发者ID:NarendraSickarwar,项目名称:FirebasePost,代码行数:27,代码来源:RegisterActivity.java

示例9: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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]
        }
      });
}
 
开发者ID:eneim,项目名称:Project-Chao,代码行数:26,代码来源:AuthDialogFragment.java

示例10: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
                    }
                }
            });
}
 
开发者ID:douglasmarques,项目名称:survey-android,代码行数:27,代码来源:LoginTempActivity.java

示例11: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
                    }
                }
            });
}
 
开发者ID:douglasmarques,项目名称:survey-android,代码行数:27,代码来源:LoginActivity.java

示例12: handleFacebookAccessToken

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
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();
                    }

                    // ...
                }
            });
}
 
开发者ID:douglasmarques,项目名称:survey-android,代码行数:24,代码来源:RegisterActivity.java

示例13: onSuccess

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
@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();
                }
            });
}
 
开发者ID:Danihelsan,项目名称:MikuyConcept,代码行数:19,代码来源:LoginPresenter.java

示例14: doInBackground

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
@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;
}
 
开发者ID:ultramega,项目名称:flavordex,代码行数:22,代码来源:SettingsActivity.java

示例15: facebookLogin

import com.google.firebase.auth.FacebookAuthProvider; //导入依赖的package包/类
@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);
          }
        });
}
 
开发者ID:fullstackreact,项目名称:react-native-firestack,代码行数:24,代码来源:FirestackAuth.java


注:本文中的com.google.firebase.auth.FacebookAuthProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。