Coder Social home page Coder Social logo

spring-attic / spring-social-facebook Goto Github PK

View Code? Open in Web Editor NEW
247.0 65.0 272.0 9.23 MB

Facebook API binding and connect support.

Home Page: http://projects.spring.io/spring-social-facebook

License: Apache License 2.0

Java 99.73% HTML 0.06% CSS 0.21%

spring-social-facebook's Introduction

spring-social-facebook is no longer actively maintained by VMware, Inc.

spring-social-facebook's People

Contributors

aludwiko avatar arhimmel avatar bh-eslee avatar bouhanef avatar digz6666 avatar dtrunk90 avatar gkgupta avatar gregmurphy avatar habuma avatar hth avatar izeye avatar januszp avatar jaspervandaele avatar kariem avatar kuc avatar mastooo avatar oxc avatar pjkcochin avatar royclarkson avatar scharron avatar sfussenegger avatar spring-builds avatar spring-operator avatar straxus avatar theigl avatar trevormarshall avatar wilkinsona avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-social-facebook's Issues

How things are going with Facebook Ads API (Marketing API)?

Hi,
I need to access to Facebook Ads/Insights API. It would be convenient to access it through Spring Social Facebook extension. But currently it is not possible.

On github I found some old implementation that was not merged in (#3). On Spring Social Facebook JIRA I also found old unresolved issue (SOCIALFB-34).

So I want to ask question: how things are going with integration between Spring Social Facebook and Facebook Ads/Marketing API? What are the plans? Why changes were not merged into master branch?

Please notice that I am willing to spend some time on this issue if it is required. I have to implement this feature no matter what. So I can share it on github if you want.

Missing post fields

The Post class object returned by FeedOperations methods (like getFeed() ) doesn't contain such fields as:

  • privacy
  • place
  • story
  • comments
  • likes
  • shares
  • status_type

Please see here https://developers.facebook.com/docs/reference/api/post/

But if I make a Facebook API call using this URL
https://developers.facebook.com/tools/explorer?method=GET&path=habuma%2Ffeed

I will get JSON (Posts) with all fields listed above without any additional API calls.

Please do not ignore fields mentioned above, parse them from JSON and add to Post (org.springframework.social.facebook.api.Post)

There is no way to get such Facebook post fields, even using additional Spring Social Facebook method calls: privacy, place, story, shares, status_type

Also I have noticed that Post.getLikeCount() always returns 0

However, comments and likes can be retrieved using additional invocation of LikeOperations and CommentOperations methods, but it is still not acceptable because we should do 2 additional requests on each Post that hit rate limit very hard. Facebook Rate limit is unofficial but exists, please see here
http://stackoverflow.com/questions/8805316/facebook-graph-api-rate-limit-and-batch-requests

PageTemplate.search(query, lat, lon, distance) - distance is not optional

In 2.0.0.M1 Spring Social Facebook, the distance method parameter is primitive and non-nullable - therefore the 'distance' parameter must be set when the Facebook API /search contract declares distance as an optional parameter when searching for places.

Re-implementing the search(query, lat, lon, distance) as the following would allow the distance parameter to be optional.

public PagedList<Page> search(String query, double latitude, double longitude, Long distance) {
    requireAuthorization();
    MultiValueMap<String, String> queryMap = new LinkedMultiValueMap<String, String>();
    queryMap.add("q", query);
    queryMap.add("type", "place");
    queryMap.add("center", latitude + "," + longitude);
    if(distance !=null){
         queryMap.add("distance", distance.toString());
    }
    return graphApi.fetchConnections("search", null, Page.class, queryMap);
}

Additionally, the PageTemplate implementation exposes a generic Page search(String query) method, however the PageOperations interface does not surface this method - any particular reason?

Profile location state and Country are null

When getting a profile location ou hometown like:
Facebook facebook = new FacebookTemplate(token)
FacebookProfile fbProfile = facebook.userOperations().userProfile
location = facebook.pageOperations().getPage(fbProfile.location.id).location

fbProfile.location returns only name and id
with the id we can get the page/place by doing

facebook.pageOperations().getPage(fbProfile.location.id).location
This location returned is a city and the has just a name and lat long position, no id, no state, no country.
Like shown at the print screen at the link above:
captura de tela 2014-03-11 11 01 34

Feed parse from page fails because its trying to access age_range from Page

My code:

AccessGrant accessGrant = new AccessGrant(token);
Connection<Facebook> facebookConnection = facebookConnectionFactory.createConnection(accessGrant);
return facebookConnection.getApi().feedOperations().getFeed(facebookPageId, new PagingParameters(limit, offset, since, until));

Version: cd965d1

Stacktrace:

Created GET request for "https://graph.facebook.com/v2.2/me?fields=id%2Cabout%2Cage_range%2Cbio%2Cbirthday%2Ccontext%2Ccover%2Ccurrency%2Cdevices%2Ceducation%2Cemail%2Cfavorite_athletes%2Cfavorite_teams%2Cfirst_name%2Cgender%2Chometown%2Cinspirational_people%2Cinstalled%2Cis_verified%2Clanguages%2Clast_name%2Clink%2Clocale%2Clocation%2Cmiddle_name%2Cname%2Cname_format%2Cpolitical%2Cquotes%2Crelationship_status%2Creligion%2Csignificant_other%2Ctimezone%2Cthird_party_id%2Cverified%2Cwebsite%2Cwork"
Setting request Accept header to [application/json, application/*+json]
GET request for "https://graph.facebook.com/v2.2/me?fields=id%2Cabout%2Cage_range%2Cbio%2Cbirthday%2Ccontext%2Ccover%2Ccurrency%2Cdevices%2Ceducation%2Cemail%2Cfavorite_athletes%2Cfavorite_teams%2Cfirst_name%2Cgender%2Chometown%2Cinspirational_people%2Cinstalled%2Cis_verified%2Clanguages%2Clast_name%2Clink%2Clocale%2Clocation%2Cmiddle_name%2Cname%2Cname_format%2Cpolitical%2Cquotes%2Crelationship_status%2Creligion%2Csignificant_other%2Ctimezone%2Cthird_party_id%2Cverified%2Cwebsite%2Cwork" resulted in 400 (Bad Request); invoking error handler
{"error":{"message":"(#100) Tried accessing nonexisting field (age_range) on node type (Page)","type":"OAuthException","code":100}}
Error from Facebook: {"error":{"message":"(#100) Tried accessing nonexisting field (age_range) on node type (Page)","type":"OAuthException","code":100}}
Facebook feed parse cron job failed.
(#100) Tried accessing nonexisting field (age_range) on node type (Page)
org.springframework.social.UncategorizedApiException: (#100) Tried accessing nonexisting field (age_range) on node type (Page)
    at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleUncategorizedError(FacebookErrorHandler.java:158)
    at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleError(FacebookErrorHandler.java:68)
    at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:615)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:573)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:544)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:252)
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:212)
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:207)
    at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:52)
    at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:48)
    at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:42)
    at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:30)
    at org.springframework.social.connect.support.AbstractConnection.setValues(AbstractConnection.java:174)
    at org.springframework.social.connect.support.AbstractConnection.initKey(AbstractConnection.java:137)
    at org.springframework.social.connect.support.OAuth2Connection.<init>(OAuth2Connection.java:75)
    at org.springframework.social.connect.support.OAuth2ConnectionFactory.createConnection(OAuth2ConnectionFactory.java:91)
    at mn.astvision.ubds.util.facebook.FacebookUtil.getFeed(FacebookUtil.java:40)
    at mn.astvision.ubds.util.facebook.FacebookUtil.getFeed(FacebookUtil.java:35)
    at mn.astvision.ubds.cron.FacebookFeedParseCronJob.updateTicketFromPosts(FacebookFeedParseCronJob.java:61)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.springframework.web.client.HttpClientErrorException: 400 Bad Request
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
    at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleUncategorizedError(FacebookErrorHandler.java:155)
    ... 27 more

Failed to post as a Page

Using spring-social-facebook-2.0.1.RELEASE.jar

When trying to post as a Page admin I get the following error:

(#100) Tried accessing nonexisting field (accounts) on node type (Page)

My code is:

            String accessToken = ... ; // the page access token
            String pageId = ...; // the page id 
            Facebook facebook = new FacebookTemplate(accessToken);
            PageOperations pageOperations = facebook.pageOperations();
            PagePostData pagePostData = new PagePostData(pageId);
            pagePostData.link("http://www.mysite.com/mypage", null, null, null, null);
            pageOperations.post(pagePostData);

The stack trace is:

org.springframework.social.UncategorizedApiException: (#100) Tried accessing nonexisting field (accounts) on node type (Page)
    at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleFacebookError(FacebookErrorHandler.java:91) ~[FacebookErrorHandler.class:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleError(FacebookErrorHandler.java:59) ~[FacebookErrorHandler.class:2.0.1.RELEASE]
    at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:614) ~[RestTemplate.class:4.1.6.RELEASE]
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:570) ~[RestTemplate.class:4.1.6.RELEASE]
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:545) ~[RestTemplate.class:4.1.6.RELEASE]
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:253) ~[RestTemplate.class:4.1.6.RELEASE]
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchConnections(FacebookTemplate.java:229) ~[FacebookTemplate.class:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchConnections(FacebookTemplate.java:223) ~[FacebookTemplate.class:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.PageTemplate.getAccounts(PageTemplate.java:61) ~[PageTemplate.class:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.PageTemplate.getAccount(PageTemplate.java:125) ~[PageTemplate.class:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.PageTemplate.getAccessToken(PageTemplate.java:115) ~[PageTemplate.class:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.PageTemplate.post(PageTemplate.java:77) ~[PageTemplate.class:2.0.1.RELEASE]

The log:

o.a.h.impl.execchain.MainClientExec - : Executing request GET /v2.3/me/accounts HTTP/1.1
o.a.h.impl.execchain.MainClientExec - : Proxy auth state: UNCHALLENGED
org.apache.http.headers - : http-outgoing-0 >> GET /v2.3/me/accounts HTTP/1.1
org.apache.http.headers - : http-outgoing-0 >> Accept: application/json, application/*+json
org.apache.http.headers - : http-outgoing-0 >> Authorization: OAuth CAAMLZBlqp0eEBAAmu1eezUeIzQUcTTZCvotVUjZBel6uvBNYscEk8MCtFTnmnPpvGEvtygl1QDclJxK6Y5yaIbJCSatLwONYwFDmyg4cklUTCNl8I6MnMn3zDtbhGXBJSF2oOKj9z1VOogOOzQwZCdcf5PGD0bh9ZAHxeYbYrGzhcZB93jZB32RqwuKEfKcWz8ZD
org.apache.http.headers - : http-outgoing-0 >> Host: graph.facebook.com
org.apache.http.headers - : http-outgoing-0 >> Connection: Keep-Alive
org.apache.http.headers - : http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5 (Java/1.7.0_67)
org.apache.http.headers - : http-outgoing-0 >> Accept-Encoding: gzip,deflate
org.apache.http.wire - : http-outgoing-0 >> "GET /v2.3/me/accounts HTTP/1.1[\r][\n]"
org.apache.http.wire - : http-outgoing-0 >> "Accept: application/json, application/*+json[\r][\n]"
org.apache.http.wire - : http-outgoing-0 >> "Authorization: OAuth CAAMLZBlqp0eEBAAmu1eezUeIzQUcTTZCvotVUjZBel6uvBNYscEk8MCtFTnmnPpvGEvtygl1QDclJxK6Y5yaIbJCSatLwONYwFDmyg4cklUTCNl8I6MnMn3zDtbhGXBJSF2oOKj9z1VOogOOzQwZCdcf5PGD0bh9ZAHxeYbYrGzhcZB93jZB32RqwuKEfKcWz8ZD[\r][\n]"
org.apache.http.wire - : http-outgoing-0 >> "Host: graph.facebook.com[\r][\n]"
org.apache.http.wire - : http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
org.apache.http.wire - : http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5 (Java/1.7.0_67)[\r][\n]"
org.apache.http.wire - : http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
org.apache.http.wire - : http-outgoing-0 >> "[\r][\n]"
org.apache.http.wire - : http-outgoing-0 << "HTTP/1.1 400 Bad Request[\r][\n]"
org.apache.http.wire - : http-outgoing-0 << "WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "(#100) Tried accessing nonexisting field (accounts) on node type (Page)"[\r][\n]"

My take:

the library is trying to get the account details using a page token, which is not a permitted operation.
I guess it should skip this step, which is needed when posting as the user (with a user access token), if the access token is a PAGE access token.

where can i get the platform source?

To use facebook graph api v.2.0, some code should be modified.
For example, the class FriendTemplate is not supported 2.0

the variable FULL_PROFILE_FIELDS causes bug. user name is not supported no more. If I correct this, where could I get the original source?

the error is like this WARN : org.springframework.web.client.RestTemplate - GET request for "https://graph.facebook.com/me/friends?fields=id%2Cusername%2Cname%2Cfirst_name%2Clast_name%2Cgender%2Clocale%2Ceducation%2Cwork%2Cemail%2Cthird_party_id%2Clink%2Ctimezone%2Cupdated_time%2Cverified%2Cabout%2Cbio%2Cbirthday%2Clocation%2Chometown%2Cinterested_in%2Creligion%2Cpolitical%2Cquotes%2Crelationship_status%2Csignificant_other%2Cwebsite" resulted in 400 (Bad Request); invoking error handler {"error":{"message":"(#100) Unknown fields: username.","type":"OAuthException","code":100}}

PagedListUtils not public

Is there a reason that this class isn't public?

The methods contained are quite useful if you're accessing Facebook API end points which aren't catered for by spring-social-facebook already. At the moment, I've had to duplicate the methods in my application which seems wasteful.

MappingInstantiationException for no default constructor in Reference

Mongo keeps complaining about no default constructor for Reference. I have created a pull request that solves this problem. I have been waiting for this fix since release 1.x. Will really appreciate if this gets integrated for next release.

34:22:629 DEBUG o.s.w.s.FrameworkServlet.processRequest Message=Could not complete request
org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate org.springframework.social.facebook.api.Reference using constructor NO_CONSTRUCTOR with arguments 
    at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:64)
    at org.springframework.data.convert.BytecodeGeneratingEntityInstantiator.createInstance(BytecodeGeneratingEntityInstantiator.java:76)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:250)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:231)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readCollectionOrArray(MappingMongoConverter.java:903)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1164)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.access$200(MappingMongoConverter.java:78)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:1115)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:866)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:281)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:269)
    at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:269)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:231)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:191)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:187)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:78)
    at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:2191)
    at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1873)
    at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1696)
    at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1679)
    at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:598)

How to provide proxy credentials

Using system properties, proxy hostname and port are available in org.springframework.social.support.ClientHttpRequestFactorySelector but proxy username and password not used because of which getting error : 407 (Proxy Authentication Required); invoking error handler

Facebook connection infinite redirect loop workaround

Last couple of weeks we're facing lot of following errors when users try to sign up with Facebook to our app

org.springframework.social.connect.web.ProviderSignInController oauth2Callback: Exception while completing OAuth 2 connection: 
java.lang.IllegalStateException: The OAuth2 'state' parameter doesn't match.

thanks to nasty Facebook bug: Callback URL being called multiple times

Because we all know how responsive is FB with fixing the issues I wonder if could be some workaround done here.

This error can be easily replicated

  1. check out https://github.com/spring-projects/spring-social-samples/tree/master/spring-social-showcase-sec-xml project
  2. into signin.jsp file put `<% Thread.sleep(5000) %>
  3. run the app using mvn tomcat:run-war
  4. open the app in anonymous/private browser session
  5. try to connect to Facebook
  6. after filling your credentials you get into infinite loop

I've tried couple of workarounds but none of them worked

  1. if you try to disable state verification you'll end up with multiple connection because on the beginning of each loop you'll get fresh code parameter from facebook (but still it would be nice if the verification can be disabled in application context configuration)
  2. if you don't remove state parameter from the session once used for a first time you'll end up with state already used exception.

Pagination

Hello

I know that Facebook support several ways of Paginating see http://developers.facebook.com/docs/reference/api/pagination/

I tried to find the ways how to do it. I saw that there is unofficial brunch http://developers.facebook.com/docs/reference/api/pagination/ but I looks like it is enough old. Moreover I saw that there is official branch v1.1.0M2 which supports one more way of pagination. However it does not work for me (NPE). I can provide my stacktrace if you develop this branch.

I really need something more than offset/limit. Please advice.

org.springframework.social.facebook.api.Reference class is missing default (no-args) constructor.

This brakes deserialization from Mongo.
This brakes deserialization from json.
In my case - I'm able to persist Spring's own FacebookProfile to mongo. But I fail to read it back.

Proposed fix:
with Json:

  • Either add @JsonCreator, or add the default constructor to the Reference.
    with Mongo:
  • Either use custom converter, or, again, add the default constructor to the Reference.

Exception thrown:
...
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.social.facebook.api.Reference]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.social.facebook.api.Reference.()
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:108)
at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:61)
... 54 common frames omitted
Caused by: java.lang.NoSuchMethodException: org.springframework.social.facebook.api.Reference.()
at java.lang.Class.getConstructor0(Class.java:2849)
at java.lang.Class.getDeclaredConstructor(Class.java:2053)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:105)
... 55 common frames omitted

OAuth2Template implementation breaks oauth dialog

Looking at the recent change to remove the FacebookOAuth2Template, the URL for facebook's oauth dialog seems to have the Graph Api version missing.

in v2.0.0.M1, the oauth URL would be
https://www.facebook.com/v2.0/dialog/oauth?client_id=...

in v2.0.0.RC1, it is
https://www.facebook.com/dialog/oauth?client_id=...

In the FacebookServiceProvider.java, there's a URL :

OAuth2Template oAuth2Template = new OAuth2Template(appId, appSecret,
                "https://www.facebook.com/dialog/oauth", 
                GraphApi.GRAPH_API_URL + "oauth/access_token");

Profile URL does not work for non-app-scoped user IDs

FacebookAdapter sets the profile URL to https://www.facebook.com/app_scoped_user_id/{userId}. This URL does however not work for non-app-scoped IDs, i.e. users that first authenticated with API versions earlier than 2.0.

The fix is to user profile.getLink() in ProfileAdapter.

V2.0.0M1 breaks some stuff..

Hi,

template.feedOperations().getLinks() causes JsonMappingException on Post$Privacy field.

** UPDATE
Same goes for getPosts() & getFeed()

Thanks,
Yoni

UncategorizedApiException

I have been getting the following JsonMappingException using both the RC1 download and the latest source via GitHub:

org.codehaus.jackson.map.JsonMappingException: Could not resolve type id 'swf' into a subtype of [simple type, class org.springframework.social.facebook.api.Post] at [Source: N/A; line: -1, column: -1]

Using the latest source, this is wrapped into UncategorizedApiException in the deserializeDataList method of the FacebookTemplate class. This happens while getting a Facebook feed, which uses the fetchConnections method of the same FacebookTemplate class. Instead of an expected type value of link, photo, video, etc., it looks like Facebook returns a type of 'swf', which Jackson cannot handle since it does not map to any of the subtypes of the Post class. At least, that's what I think has happened?

If I am correct and since such discrepancies may (and I think frequently will) happen with any social api, shouldn't there be a fallback strategy? In this case, I'm thinking of either a way to ignore (if desired) such exceptions so that at least the rest of the feed can be captured, or a default handler for uncategorized types that may be implemented by developers depending on their needs.

Even though not directly related to the above, in a similar spirit, wouldn't it be nice to provide a convenient way to extend the functionality of the templates and operations interfaces. First of all, these social apis change unexpectedly and it would be nice to keep up-to-date without waiting for the next version of spring social to catch up. If we could extend existing classes with a few added or modified methods until a new version, this would help immensely with regard to maintenance. Currently, as far as I can see, there are too many private properties preventing such extensions. Even when the social api does not change, it would be useful to extend these classes for application-specific extensions. For example, currently you can only fetch an image as a byte array. However, it may be preferable to fetch the url for each image and let the browser handle downloading each image. To add such functionality, one would need to extend UserOperations, GraphApi, UserTemplate, FacebookTemplate with a few simple method definitions.

Anyhow, Spring Social is great, thanks for the hard work, and thanks for taking the time to look into the above issue.

Authentication Fails due to unrecognized field 'id' in WorkEntry.Project

The actual problem is that WorkEntry.Project fails to parse (see stacktrace below).

The returned data looks like this:

  "work": [
    {
      "employer": {
        "id": "{id}", 
        "name": "{name}"
      }, 
      "projects": [
        {
          "id": "{id}", 
          "name": "{name}"
        }, 
        {
          "id": "{id}", 
          "name": "{name}"
        }
      ], 
      "start_date": "{date}"
    }
  ]

The real cause however is that FacebookAdapter.setConnectionValues() fetches far too much data.

Stacktrace:

org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized field "id" (class org.springframework.social.facebook.api.WorkEntry$Project), not marked as ignorable (4 known properties: "end_date", "start_date", "description", "with"])
 at [Source: java.io.ByteArrayInputStream@3f9d6ec6; line: 1, column: 8712] (through reference chain: org.springframework.social.facebook.api.User["work"]->org.springframework.social.facebook.api.WorkEntry["projects"]->org.springframework.social.facebook.api.Project["id"]); nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "id" (class org.springframework.social.facebook.api.WorkEntry$Project), not marked as ignorable (4 known properties: "end_date", "start_date", "description", "with"])
 at [Source: java.io.ByteArrayInputStream@3f9d6ec6; line: 1, column: 8712] (through reference chain: org.springframework.social.facebook.api.User["work"]->org.springframework.social.facebook.api.WorkEntry["projects"]->org.springframework.social.facebook.api.Project["id"])
    at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.readJavaType(MappingJackson2HttpMessageConverter.java:228) ~[spring-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.read(MappingJackson2HttpMessageConverter.java:220) ~[spring-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:95) ~[spring-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:550) ~[spring-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:518) ~[spring-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:256) ~[spring-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:214) ~[spring-social-facebook-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:209) ~[spring-social-facebook-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:53) ~[spring-social-facebook-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:49) ~[spring-social-facebook-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:43) ~[spring-social-facebook-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:31) ~[spring-social-facebook-2.0.1.RELEASE.jar:2.0.1.RELEASE]
    at org.springframework.social.connect.support.AbstractConnection.setValues(AbstractConnection.java:174) ~[spring-social-core-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at org.springframework.social.connect.support.AbstractConnection.initKey(AbstractConnection.java:137) ~[spring-social-core-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at org.springframework.social.connect.support.OAuth2Connection.<init>(OAuth2Connection.java:75) ~[spring-social-core-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at org.springframework.social.connect.support.OAuth2ConnectionFactory.createConnection(OAuth2ConnectionFactory.java:91) ~[spring-social-core-1.1.0.RELEASE.jar:1.1.0.RELEASE]
    at org.springframework.social.security.provider.OAuth2AuthenticationService.getAuthToken(OAuth2AuthenticationService.java:99) ~[spring-social-security-1.1.0.RELEASE.jar:1.1.0.RELEASE]
...
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "id" (class org.springframework.social.facebook.api.WorkEntry$Project), not marked as ignorable (4 known properties: "end_date", "start_date", "description", "with"])
 at [Source: java.io.ByteArrayInputStream@3f9d6ec6; line: 1, column: 8712] (through reference chain: org.springframework.social.facebook.api.User["work"]->org.springframework.social.facebook.api.WorkEntry["projects"]->org.springframework.social.facebook.api.Project["id"])
    at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:731) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:915) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1292) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1270) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:247) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:232) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:206) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:25) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:538) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:106) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:242) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:232) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:206) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:25) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:538) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:106) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:242) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051) ~[jackson-databind-2.4.0.jar:2.4.0]
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2206) ~[jackson-databind-2.4.0.jar:2.4.0]
    at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.readJavaType(MappingJackson2HttpMessageConverter.java:225) ~[spring-web-4.0.4.RELEASE.jar:4.0.4.RELEASE]
    ... 66 common frames omitted

MongoDB persist failure on Reference object

In MongoDB, persisting Reference object works fine but retrieving fails as there is no default constructor. Something like this solves the exception below. Preferred, if this is fixed in 1.1.1 and 2.0.0

 @SuppressWarnings("unused")
 private Reference() {
     this(null, null);
 }

2014-07-08 22:50:44,631 [http-bio-8080-exec-10] ERROR org.springframework.social.connect.web.ProviderSignInController- Exception while completing OAuth 2 connection: 
org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate org.springframework.social.facebook.api.Reference using constructor NO_CONSTRUCTOR with arguments 
at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:64)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:243)

1.1.0.M3 PagedListUtils bug

I have found bug in the following method

org.springframework.social.facebook.api.impl.PagedListUtils#getPagedListParameters(JsonNode pagingNode, String pageKey)

The following code
return new PagingParameters(
offsetString != null ? Integer.valueOf(offsetString) : null,
limitString != null ? Integer.valueOf(limitString) : null,
sinceString != null ? Long.valueOf(sinceString) : null,
untilString != null ? Long.valueOf(untilString) : null);

have to be replaced to the following one:
return new PagingParameters(
limitString != null ? Integer.valueOf(limitString) : null,
offsetString != null ? Integer.valueOf(offsetString) : null,
sinceString != null ? Long.valueOf(sinceString) : null,
untilString != null ? Long.valueOf(untilString) : null);

as we have wrong order of limit and offset params.

Error deserializing data when fetching photos

We have a problem with fetching photos in some accounts.

Spring Social version: 1.0.2.RELEASE
Facebook profile: https://www.facebook.com/SugarLand.TX

Please see exception:
org.springframework.social.UncategorizedApiException: Error deserializing data
from Facebook: Instantiation of [simple type, class
org.springframework.social.facebook.api.Photo] value failed: Index: 2, Size: 2
(through reference chain:
org.springframework.social.facebook.api.Photo["link"])
at
org.springframework.social.facebook.api.impl.FacebookTemplate.deserializeDataList(FacebookTemplate.java:272)
at
org.springframework.social.facebook.api.impl.FacebookTemplate.fetchConnections(FacebookTemplate.java:186)
at
org.springframework.social.facebook.api.impl.MediaTemplate.getPhotos(MediaTemplate.java:100)
....
at java.lang.Thread.run(Thread.java:662)
Caused by: org.codehaus.jackson.map.JsonMappingException: Instantiation of
[simple type, class org.springframework.social.facebook.api.Photo] value
failed: Index: 2, Size: 2 (through reference chain:
org.springframework.social.facebook.api.Photo["link"])
at
org.codehaus.jackson.map.deser.std.StdValueInstantiator.wrapException(StdValueInstantiator.java:388)
at
org.codehaus.jackson.map.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:232)
at
org.codehaus.jackson.map.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:118)
at
org.codehaus.jackson.map.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:910)
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObjectUsingNonDefault(BeanDeserializer.java:739)
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:683)
at
org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
at
org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:217)
at
org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:194)
at
org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:30)
at
org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2704)
at
org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:2031)
at
org.springframework.social.facebook.api.impl.FacebookTemplate.deserializeDataList(FacebookTemplate.java:270)

facebook schema error

When i try to add spring-social to my project i get this error for social.xml.
Any suggestion for that?

Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://
www.springframework.org/schema/social/spring-social-facebook.xsd', because 1) could not
find the document; 2) the document could not be read; 3) the root element of the document is
not xsd:schema.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be
found for element 'facebook:config'.

Album type is always null

Version: 2.0.2.RELEASE

This is how I create a Facebook instance

@Configuration
public class SocialConfiguration {
    @Autowired
    private Environment env;

    @Bean
    public Facebook facebook() {
        return new FacebookTemplate(env.getProperty("facebook.accessToken"));
    }
}

And this is how I use it:

for (Album album : facebook.mediaOperations().getAlbums(env.getProperty("facebook.pageId"), new PagingParameters(null, null, null, null))) {
    log.debug("check if album is of type normal: {}", album.getType());
    if (Album.Type.NORMAL.equals(album.getType())) {
        // ...
    }
}

And here's the output:

DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null
DEBUG d.s.w.c.f.FacebookGalleryCache - check if album is of type normal: null

Complex queries do not work when searching within Facebook's public feed

Hi,
when I want to search within Facebook's public feed using FeedTemplate.searchPublicFeed(String, int, int) it works fine, when there is only one keyword within the query. Facebook supports also logical operators like AND (which actually is represented by a space or +), OR (which is represented by a pipe framed by spaces) and quotes.
Using those operators within a query passed through searchPublicFeed(String, int, int) wouldn't return any results. The reason for that is that internally the query is built and encoded. Since the search terms are also encoded, Facebook is unable to interpret them correctly. This is the same issue when using special characters like German Umlaute.
A solution might be to disable encoding for the search terms. But this seems to be a dirty hack, doesn't it?

Error Fetching Status Entries

Hello,

I'm very impressed with the plugin so far. It seems very complete and I have had excellent luck with it.

I ran into an issue this evening with the getStatuses(userId) method.

def facebook = new FacebookTemplate(accessToken)
println facebook.feedOperations().getStatuses(userId)
org.quartz.JobExecutionException [See nested exception: java.lang.NullPointerException]
    at org.codehaus.groovy.grails.plugins.quartz.GrailsJobFactory$GrailsTaskClassJob.execute(GrailsJobFactory.java:81)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
Caused by: java.lang.NullPointerException
    at org.springframework.social.facebook.api.impl.json.PostMixin$LikesCountDeserializer.deserialize(PostMixin.java:130)
    at org.springframework.social.facebook.api.impl.json.PostMixin$LikesCountDeserializer.deserialize(PostMixin.java:126)
    at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:252)
    at org.codehaus.jackson.map.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:620)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:472)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:368)
    at org.codehaus.jackson.map.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:77)
    at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeWithType(BeanDeserializer.java:423)
    at org.codehaus.jackson.map.deser.StdDeserializerProvider$WrappedDeserializer.deserialize(StdDeserializerProvider.java:460)
    at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2376)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1731)
    at org.springframework.social.facebook.api.impl.FeedTemplate.deserializePost(FeedTemplate.java:274)
    at org.springframework.social.facebook.api.impl.FeedTemplate.deserializeList(FeedTemplate.java:260)
    at org.springframework.social.facebook.api.impl.FeedTemplate.getStatuses(FeedTemplate.java:99)
    at org.springframework.social.facebook.api.impl.FeedTemplate.getStatuses(FeedTemplate.java:93)
    at org.springframework.social.facebook.api.FeedOperations$getStatuses.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
    at iforce.FacebookJob.execute(FacebookJob.groovy:42)
    at sun.reflect.GeneratedMethodAccessor530.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:186)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:171)
    at org.codehaus.groovy.grails.plugins.quartz.GrailsJobFactory$GrailsTaskClassJob.execute(GrailsJobFactory.java:77)
    ... 2 more

I found the same issue on this thread as well:
http://forum.springsource.org/showthread.php?114901-NullPointer-to-get-status-from-Facebook

Is there any additional information I should provide to help debug this?

Cheers,
Casey

Can we have an option to override Graph API version?

Latest snapshots of Spring Social Facebook have switched to v2.2 of Facebook API.

However, in v2.1 and above Facebook removed support for FQL, while sticking with v2.0 API allows applications to use FQL for one more year. Currently Spring Social Facebook doesn't provide a way to change API version it uses without changing its source code.

So, it would be nice to allow application developers to override Facebook API version used by Spring Social Facebook on their own risk.

FriendTemplate.getTaggableFriends() does not work

When using the getTaggableFriends() method (version 2.0.0.RELEASE), the following error is returned by Facebook:

{
  "error": {
    "message": "Syntax error \"Expected end of string instead of \"(\".\" at character 13: picturefields(is_silhouette,url,width,height)", 
    "type": "OAuthException", 
    "code": 2500
  }
}

The reason for this, is that the end point requests the following fields, with picturefields being the problem:

"id", "name" ,"picturefields(is_silhouette,url,width,height)", "first_name", "last_name", "middle_name"

The following is the format that Facebook expects for the picture fields:

"id", "name", "picture{is_silhouette,url,width,height}", "first_name", "last_name", "middle_name"

1.0.3.RELEASE EventTemplate bug or missing functionality

Hi,
First of all i think that the library is awesome.

Then, i wanted to notify that the method EventTemplate.getInvitations() only gets the invitations that a user has responded. So if the user receives the invitation and ignores it, it won't be shown because the used connection URL : https://graph.facebook.com/userId/events/ .

To get the events the user has not replied yet, one should call the /events/not_replied end point. So the workaround is as followed:
List invitations = facebook.fetchConnections(userId,
"events/not_replied", Invitation.class, parameters);
which uses https://graph.facebook.com/userId/events/not_replied/

I wonder if it is worth adding in EventTemplate because the user may need to see all the events at once. So maybe the class could expose the method or include it in getInvitations() one.

Thanks.

Why it needs to access user profile when we're using page access token instead of user access token?

GET request for "https://graph.facebook.com/v2.2/me?fields=id%2Cabout%2Cage_range%2Cbio%2Cbirthday%2Ccontext%2Ccover%2Ccurrency%2Cdevices%2Ceducation%2Cemail%2Cfavorite_athletes%2Cfavorite_teams%2Cfirst_name%2Cgender%2Chometown%2Cinspirational_people%2Cinstalled%2Cis_verified%2Clanguages%2Clast_name%2Clink%2Clocale%2Clocation%2Cmiddle_name%2Cname%2Cname_format%2Cpolitical%2Cquotes%2Crelationship_status%2Creligion%2Csignificant_other%2Ctimezone%2Cthird_party_id%2Cverified%2Cwebsite%2Cwork" resulted in 400 (Bad Request); invoking error handler
{"error":{"message":"(#100) Tried accessing nonexisting field (age_range) on node type (Page)","type":"OAuthException","code":100}}

1.1.0.RELEASE pom refers to BUILD-SNAPSHOT, is unusable

I'm hoping I've fundamentally missed something. I upgraded our project to reference 1.1.0.RELEASE of spring social components and the build failed as a 1.1.0.BUILD-SNAPSHOT could not be found.

Upon inspection, this component's release POM depends on non-released components rendering it unusable, at least in a Maven project.

See http://search.maven.org/#artifactdetails%7Corg.springframework.social%7Cspring-social-facebook%7C1.1.0.RELEASE%7Cjar

The spring-social-linkedin:1.0.0.RELEASE is also bad: http://search.maven.org/#artifactdetails%7Corg.springframework.social%7Cspring-social-linkedin%7C1.0.0.RELEASE%7Cjar

How to write comment as facebook page admin not as authenticated user?

CommentOperations.addComment writes comment as authenticated user, how to write as facebook page admin?

AccessGrant accessGrant = new AccessGrant(token);
Connection<Facebook> facebookConnection = facebookConnectionFactory.createConnection(accessGrant);
facebookConnection.getApi().commentOperations().addComment(postId, comment);

I tried using page token instead of user and it throws following exception:

GET request for "https://graph.facebook.com/v2.2/me?fields=id%2Cabout%2Cage_range%2Cbio%2Cbirthday%2Ccontext%2Ccover%2Ccurrency%2Cdevices%2Ceducation%2Cemail%2Cfavorite_athletes%2Cfavorite_teams%2Cfirst_name%2Cgender%2Chometown%2Cinspirational_people%2Cinstalled%2Cis_verified%2Clanguages%2Clast_name%2Clink%2Clocale%2Clocation%2Cmiddle_name%2Cname%2Cname_format%2Cpolitical%2Cquotes%2Crelationship_status%2Creligion%2Csignificant_other%2Ctimezone%2Cthird_party_id%2Cverified%2Cwebsite%2Cwork" resulted in 400 (Bad Request); invoking error handler
{"error":{"message":"(#100) Tried accessing nonexisting field (age_range) on node type (Page)","type":"OAuthException","code":100}}

Stacktrace

 org.springframework.web.client.HttpClientErrorException: 400 Bad Request
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
    at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleUncategorizedError(FacebookErrorHandler.java:155)
    at org.springframework.social.facebook.api.impl.FacebookErrorHandler.handleError(FacebookErrorHandler.java:68)
    at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:615)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:573)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:544)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:252)
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:212)
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:207)
    at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:52)
    at org.springframework.social.facebook.api.impl.UserTemplate.getUserProfile(UserTemplate.java:48)
    at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:42)
    at org.springframework.social.facebook.connect.FacebookAdapter.setConnectionValues(FacebookAdapter.java:30)
    at org.springframework.social.connect.support.AbstractConnection.setValues(AbstractConnection.java:174)
    at org.springframework.social.connect.support.AbstractConnection.initKey(AbstractConnection.java:137)
    at org.springframework.social.connect.support.OAuth2Connection.<init>(OAuth2Connection.java:75)
    at org.springframework.social.connect.support.OAuth2ConnectionFactory.createConnection(OAuth2ConnectionFactory.java:91)
    at mn.astvision.ubds.util.facebook.FacebookUtil.comment(FacebookUtil.java:56)
    at mn.astvision.ubds.controller.TicketController.createLog(TicketController.java:538)
    at mn.astvision.ubds.controller.TicketController$$FastClassBySpringCGLIB$$ad4e37d9.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
    at mn.astvision.ubds.controller.TicketController$$EnhancerBySpringCGLIB$$43fae581.createLog(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1015)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:652)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1575)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1533)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Can't deserialize posts with version 2

Can't retrieve feeds (feedOperations().getFeed()) with version 2.0.0.M1

        at org.springframework.social.facebook.api.impl.FeedTemplate.deserializePost(FeedTemplate.java:299) ~[spring-social-facebook-2.0.0.M1.jar:2.0.0.M1]
        at org.springframework.social.facebook.api.impl.FeedTemplate.deserializeList(FeedTemplate.java:275) ~[spring-social-facebook-2.0.0.M1.jar:2.0.0.M1]
        at org.springframework.social.facebook.api.impl.FeedTemplate.getFeed(FeedTemplate.java:78) ~[spring-social-facebook-2.0.0.M1.jar:2.0.0.M1]
        at org.springframework.social.facebook.api.impl.FeedTemplate.getFeed(FeedTemplate.java:64) ~[spring-social-facebook-2.0.0.M1.jar:2.0.0.M1]

FacebookLink without pictureUrl

I can't set pictureUrl using FacebookLink

public class FacebookLink {
private final String link;
private final String name;
private final String caption;
private final String description;

Release request 2.0.0

Game time folks, FB is pushing all consumers to v2, and v1 is going offline Apr 30, 2015. We've been using 1.1.1.RELEASE, but now we're getting emails from FB that our app needs to be upgraded https://developers.facebook.com/apps/upgrade/?ref=devsite_banner

"Prevent Broken Experiences in Your Mobile Apps - We Recommend Upgrading to v2.0+ Before December 25th.
Did you know it usually takes 80-140 days for 90% of people to upgrade to the latest version of your app?"

I presume 2.0.0.M1 is the current milestone. What is critical to in order to prep 2.0.0 for production?

We use social api for auth and posting. I can make myself available to test any further builds on a high-volume site.

v2.0.0M2 Required

I am seeing the following bugs in my usage of V2.0.0.0M1:

https://jira.spring.io/browse/SOCIALFB-163
https://jira.spring.io/browse/SOCIALFB-153

Building from source is currently not possible as all of our dependencies have be maven repo backed. Given that facebook will be removing v1.0 of their API in 4 weeks when can we expect a stable release of spring-social-facebook for v2.0 of the api?

If this project is no longer supported that would also be useful to know as we will use a different library.

Time granularity cannot be parsed to Enum value for some photos

For some of our users, fetching and parsing profile pictures and tagged photos, results in a parsing exception:

2015-04-10 13:51:26,085 [c-16] ERR c.s.f.v.w.c.f.FacebookGalleryPanel$FacebookPhotoModel Could not load images from facebook.
org.springframework.social.UncategorizedApiException: Error deserializing data from Facebook: Can not construct instance of org.springframework.social.facebook.api.Photo$TimeGranularity from String value 'day': value not one of declared Enum instance names: [YEAR, MONTH, DAY, HOUR, MIN, NONE]
 at [Source: java.io.StringReader@5a3774f4; line: 1, column: 26069] (through reference chain: java.util.ArrayList[6]->org.springframework.social.facebook.api.Photo["backdated_time_granularity"])

It seems that the field backdated_time_granularity sometimes contains lower case values such as day.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.