Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
843 views
in Technique[技术] by (71.8m points)

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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"}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...