I want to login with facebook to Backendless with the android SDK v4.5.1 and fetch some personal information. The fields birthday and first_name work but gender is always null. I tried the same with pure facebook SDK 4.34.0 and it worked as expected.
This is my backendless login (gender is null)
public void facebookLogin() {
LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("email", "user_birthday", "user_photos", "user_gender", "public_profile"));
}
private void loginToBackendlessWithFacebook() {
Map<String, String> facebookFieldMappings = new HashMap<>();
facebookFieldMappings.put("first_name", UserProperty.USERNAME.getPropertyName());
facebookFieldMappings.put("birthday", UserProperty.BIRTHDAY.getPropertyName());
facebookFieldMappings.put("gender", UserProperty.GENDER.getPropertyName());
Backendless.UserService.loginWithFacebookSdk(fbAccessToken, facebookFieldMappings, new AsyncCallback<BackendlessUser>() {
@Override
public void handleResponse(BackendlessUser response) {
setCurrentUserAndProceed(); // Here gender is null
}
@Override
public void handleFault(BackendlessFault fault) {
log.error("Could not backendlessLogin to facebook {}", fault.getMessage());
}
}, true);
}
This is the plain facebook request (gender is correct)
In addition i’ve tried with 4.5.1 version library. And all works.
Could you, please, try to perform the login with the old library but with code generated on “Code Gneration” section? It produces a simple example without any dependencies.
Hi,
I now tried it with the new library version 5.0.2 and the Code Generation example. But my facebook properties of the BackendlessUser are always null, if they are not already in the Users table, i.e. they are not fetched from facebook. Maybe I miss something. I try to figure it out. Thank you very much for your help, anyway!