Announcement Announcement Module
No announcement yet.
Using springsocial libraries Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using springsocial libraries


    I dont want to use sprint framework as such to use spring social. All i want is using only spring social libraries and to write my web app.

    Is it possible? If yes then for the case of fb what should i write to create a connection if i have access_token in hand?

  • #2
    From a usage perspective, you don't need to use the Spring Framework to use Spring Social's Facebook API binding. All you need to do is construct a FacebookTemplate object with the access token:

    Facebook facebook = new FacebookTemplate(accessToken);
    But, you'll need to obtain and manage the user tokens yourself, which is something that the rest of Spring Social could do for you.

    From a dependencies perspective, the Spring Social Facebook module will depend on a few other libraries from the Spring Framework. Most notably, spring-web which provides RestTemplate. FacebookTemplate uses RestTemplate to consume Facebook's Graph API. And spring-web also has a few dependencies on other Spring Framework libraries, too.
    Last edited by habuma; Aug 1st, 2011, 08:14 AM.


    • #3
      another option


      I found this way as well

      FacebookConnectionFactory connectionFactory =
      new FacebookConnectionFactory("XXX", "XXX");
      AccessGrant accessGrant = new AccessGrant("my access token");
      Connection<Facebook> connection = connectionFactory.createConnection(accessGrant);

      So is this approach same as u suggested or any better or poorer than what you used? plz advise


      • #4
        It depends. If all you want to do is get at the Facebook API binding, the way I showed is the simplest way.

        Re-reading your question, I see you did ask how to use it to create a connection. In that case the way you show is better. From there you can give it to a ConnectionRepository (such as JdbcConnectionRepository) to be stored for long-term use.