Skip to content

Instantly share code, notes, and snippets.

@azzeddineCH
Created July 16, 2017 21:15
Show Gist options
  • Save azzeddineCH/70e498c11834d302a6dc865901b8ae91 to your computer and use it in GitHub Desktop.
Save azzeddineCH/70e498c11834d302a6dc865901b8ae91 to your computer and use it in GitHub Desktop.
/**
* a public method to handel the facebook authentication
*
* @param token holds the user Facebook accessToken
*/
public void handleFacebookAccessToken(AccessToken token) {
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
FirebaseUtils.auth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.d(TAG, "signInWithCredential: success");
startChatActivity();
} else {
Toast.makeText(LauncherActivity.this, task.getException().getMessage(),
Toast.LENGTH_SHORT).show();
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment