Reputation: 786
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!
Upvotes: 1
Views: 367
Reputation: 786
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.
Upvotes: 1