Created
July 16, 2017 21:15
-
-
Save azzeddineCH/70e498c11834d302a6dc865901b8ae91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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