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

  • FacebookTemplate Question

    Hi Guys,

    I am very new to spring social and have this problem for sometime.

    Here's my problem:

    I wanted to post message update status in facebook using my spring mvc webstite.
    I had seen code snippet like this:

    FacebookTemplate facebook = new FacebookTemplate(accessToken);
    facebook.updateStatus("Spring Social can also post to Facebook!");

    However, can someone guide mo or post a code snipphet on how to obtain
    "accessToken". I already have the apiKey, apiSecret but I cant find a way to
    get "accessToken"

    Thank you spring community, hope to hear from you the soonest

  • #2
    There are a handful of ways to get an access token. At the very lowest level, you can perform the OAuth 2 "dance" with Facebook as described at But that'd require you to write the code that handles the redirection to Facebook and to receive the authorization code and exchange it for an access token.

    All of that logic is captured in Spring Social's ConnectController. After a connection is made, you can fetch a ready-to-use FacebookTemplate from the connection without having to deal with the access token directly in your code. Read to find out how to use ConnectController.