Question

Is it possible to create a link to like Facebook content, such as a photo, from outside of Facebook? I've tried to play around with passing Facebook URLs to standard like button tools but it doesn't seem to work. Any ideas greatly appreciated!

Was it helpful?

Solution

So this is possible. I got this working by setting up a Facebook app and creating basic authentication. After authentication was completed, I use JS to pull the access_token param from the returned URL and a form via POST to submit a like to the desired photo by passing the photo's FBID and user's access_token via graph.facebook.com. Looks something like this.

      <form>
       <a id="facebook-authentication" href="https://graph.facebook.com/oauth/authorize?type=user_agent&client_id=[YOUR_APP_ID_GOES_HERE]&redirect_uri=[YOUR_DESIRED_REDIRECT_PAGE_GOES_HERE]&scope=offline_access,publish_stream">
       <div id="facebook-authentication-button">
       START THE VOTE!
       </div>
       </a>
      </form>

Some additional JS is used to automatically submit the form upon redirect, but that's not necessary for setting up the submission of the like POST request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top