spring-social-facebook

Error message is (#12) bio field is deprecated for versions v2.8 and higher


I used version 2.0.3.RELEASE of spring-social-facebook and Facebook app api v2.8. I called Facebook login but returned this message. "(#12) bio field is deprecated for versions v2.8 and higher" How can i fix this?


Solution

  • I got the same error, 2.0.3.RELEASE of spring-social-facebook seems to be not compatible with v2.8 Facebook API version (released yesterday). Reading from facebook changelog for the v2.8 (https://developers.facebook.com/docs/apps/changelog):

    User Bios - The bio field on the User object is no longer available. If the bio field was set for a person, the value will now be appended to the about field.

    I think we have to wait a new release of spring-social-facebook library. In the release 2.0.3 (in the interface org.springframework.social.facebook.api.UserOperations) there is the "bio" field in the PROFILE_FIELDS constant and it is not supported in the v2.8 facebook API version.

    UPDATE: I found a workaround in my case:

    BEFORE:

    Connection<Facebook> connection = facebookConnectionFactory.createConnection(accessGrant);
    Facebook facebook = connection.getApi();
    User userProfile = facebook.userOperations().getUserProfile();//raises the exception caused by the "bio" field.
    

    AFTER

    Connection<Facebook> connection = facebookConnectionFactory.createConnection(accessGrant);
    Facebook facebook = connection.getApi();
    String [] fields = { "id", "email",  "first_name", "last_name" };
    User userProfile = facebook.fetchObject("me", User.class, fields);
    

    Here a complete list of field you could use:

    { "id", "about", "age_range", "birthday", "context", "cover", "currency", "devices", "education", "email", "favorite_athletes", "favorite_teams", "first_name", "gender", "hometown", "inspirational_people", "installed", "install_type", "is_verified", "languages", "last_name", "link", "locale", "location", "meeting_for", "middle_name", "name", "name_format", "political", "quotes", "payment_pricepoints", "relationship_status", "religion", "security_settings", "significant_other", "sports", "test_group", "timezone", "third_party_id", "updated_time", "verified", "video_upload_limits", "viewer_can_send_gift", "website", "work"}