I am developing an android app using Firebase Auth. My app should provide a login feature using Twitter. So I am developing Twitter Login using the Firebase Auth.
I should send the Twitter user's token and the secret to our backend server. But I don't know how to get them.
According to the firebase official documents,
firebaseAuth
.startActivityForSignInWithProvider(/* activity= */ this, provider.build())
.addOnSuccessListener(
new OnSuccessListener<AuthResult>() {
@Override
public void onSuccess(AuthResult authResult) {
// User is signed in.
// IdP data available in
// authResult.getAdditionalUserInfo().getProfile().
// The OAuth access token can also be retrieved:
// authResult.getCredential().getAccessToken().
// The OAuth secret can be retrieved by calling:
// authResult.getCredential().getSecret().
}
})
.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Handle failure.
}
});
onSuccess callback returns AuthResult
But when I try to use below function:
authResult.getCredential().getAccessToken()
authResult.getCredential().getSecret()
There are no functions! How can I get them???