Reputation: 48
I try to integrate spring social facebook to my project (i already have managed to integrate google+ and twitter signin). The problem i have is with facebook provider which returns null for the most values. I use below code:
Connection<Facebook> fb_connection = (Connection<Facebook>) providerSignInUtils.getConnectionFromSession(request);
fb_connection.getApi().userOperations().getUserProfile().getName();//i get the name
fb_connection.getApi().userOperations().getUserProfile().getId(); //i get the id
fb_connection.getApi().userOperations().getUserProfile().getEmail(); // email and all other values are always null
I tried many versions of spring social facebook right now i use 2.0.0.M1 which i think is the latest. Below is the signin form i use:
<!-- FACEBOOK SIGNIN -->
<form name="fb_signin" id="fb_signin" action="<c:url value="/signin/facebook"/>" method="POST">
<input type="hidden" name="scope" value="email,public_profile,user_friends" />
<button type="submit">Facebook</button>
</form>
Any ideas?
Upvotes: 1
Views: 1635
Reputation: 814
In my case I had to send the "scope" field within the form where the sign in button is placed.
<form th:action="@{/connect/facebook}" method="POST">
<button type="submit">Sign in with Facebook</button>
<input type="hidden" name="scope" value="public_profile,email"/>
</form>
Upvotes: 2
Reputation: 863
I faced the same issue and solved it upgrading to the plugin version 2.0.2.RELEASE
<!-- Spring Social Facebook -->
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-facebook</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
Upvotes: 2