SPRING SOCIAL FACEBOOK OAUTH - GETTING NOT ALL DATA WITH API V2.5

jimmy Smith

Total Post:3

Points:21
Posted by  jimmy Smith
Java 
 649  View(s)
Ratings:
Rate this:
I am trying to implement facebook oauth using Spring Social, as a part of it I call the following uri

https://www.facebook.com/v1.0/dialog/oauth?client_id=12345678900&response_type=code&redirect_uri=http://some_uri.com&success_url=some_uri.com&error_url=some_uri.com&scope=email%2C+user_birthday

And I get the token just fine. However, when I try

Facebook facebookTemplate = new FacebookTemplate(accessToken);
FacebookProfile facebookProfile = facebook.userOperations().getUserProfile();
The api returns the full facebook profile with all the data (email, link etc) only in case if I've configured my app to use Facebook app in developers console which uses api 2.3. As for today the up-to-date version of api which is used by all newly created apps in the console is 2.5. In case I use newly created app with api 2.5 it returns not all data - basically only user name and id are present. I use Spring social facebook version 1.1.1.RELEASE and Spring social 1.1.0.RELEASE

Can I specify some parameter or update libraries or code, so that I get all the data using newly created apps with api version 2.5?
  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: Spring social Facebook oauth - getting not all data with api v2.5

    Spring Social Facebook v2.0.3.RELEASE targets Graph API v2.5 and should include the fields you are looking for.You are missing the scope. By default scope of spring-social-facebook is public_profile. It will only have some limited information.

    Use "email scope" instead. Refer this link Facebook oauth scopes

    You can change the scope in this way facebookConnectionFactory.setScope("email")

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!