Problem getting Facebook profile photo

Asked

Viewed 18 times

0

Good night! Using the login with Facebook, the user is authenticated perfectly, I can recover the name and email, but when I try to recover the image from the profile of fb returns a default image, for example : https://graph.facebook.com/100059613732894/picture. I’ve used some accounts and always this is the image returned, someone knows how I could solve this problem ?

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {

    callbackManager.onActivityResult(requestCode, resultCode, data);
    super.onActivityResult(requestCode, resultCode, data);

}

private void firebaseAutenticacaoFacebook(AccessToken accessToken) {

    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()) {

                        FirebaseUser user = mAuth.getCurrentUser();
                        
                        Usuario usuario = new Usuario();
                        
                        usuario.setEmail( user.getEmail() );
                        usuario.setNome ( user.getDisplayName());
                        usuario.setFoto ( user.getPhotoUrl().toString());
            
                        salvar( usuario );

                        mainScreen();

                    } else {}
                }
            });
}

 public void mainScreen(){

    Intent i = new Intent(LoginActivity.this, MainActivity.class);
    startActivity(i);
    finish();
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.