I have a webpage with a Facebook Like button (social plugin).
I need to show extra information on my page when the user has liked the page.
I know there has been similar questions but the answer has been to use the edge.create event to react to the user clicking the like button. This works fine except when the like happened prior to loading the page.
Others have suggested using a signed_request but I believe this is only applicable to canvas applications,
I know I can use the API to check for the like but this requires the user to grant permissions, but I want to do this in an anonymous manner (I am not interested in knowing who the user is, I just want to know if they liked the page).
Is there any way to do it?
Well this is exactly the difference between having a canvas app and a site that just uses the plugins. The plugin allows (you to allow) the user to like a certain URL and that's about all. In order for the site operating outside of Facebook at explicitly access that data, it'll need the correct permissions as you have noted... the user_likes permission.
Without a signed_request or the relevant permissions from the user, I do not believe that you'll be able to differentiate between users that have "liked" your URL.
Use a javascript onclick to detect when the like button is clicked and localStorage to store the info?
Related
I have read through the documentation on how to set up the Facebook Registration Plugin. In reading I saw that there are what facebook calls named fields and custom fields. What I am looking for is a check box that says "Like us on facebook". If that is clicked and the form is submitted the user auto likes our page.
I would think that there would be a field in named fields area that does this.
Some of the research I have done suggests that forcing an auto like on a user is black hat and could result in the deletion of your facebook page. This registration plugin seems like a good way to get the user to opt in to facebook marketing. Yes I could auto like them on submit if the box is checked but then how would facebook know that I have permission to do this.
Does anyone have a "white hat" solution to "liking" a facebook page within a form besides the obvious facebook like box plugin?
This is not possible.
Yes I could auto like them on submit
How would you do that? I can't think of a way to "Like" a Facebook Page programatically!
To be able to like a page, you'll need to get extended permissions from the user and use the Graph API's Publishing Feature. However, this can't be done using the Registration Social Plugin.
As I said you will need to use the Graph API to authenticate the user, while doing that you will need to request permission to publish_stream which will allow you to like your page after authentication by making a Graph POST request to Like the object.
However, although you can do this, it is far more complex than the Registration Plugin, it requires more steps and much more work on your end. However, if you really want to do it, it is certainly possibly.
I have a website serving free mp3-downloads and I would like them to be only available for facebook fans of the fb-page of the website. The links are thus hidden unless the user is a fan.
I have reached partial functionality by subscribing to the 'edge.create' event, but this event is not fired when the like box is loaded and the page has already been liked.
I don't really know what the best way to do this is, or whether it's possible at all without user permission. Most information on facebook forums is horribly outdated and a lot of it is related to on-facebook facebook apps/tabs, which is not my case.
To clarify: my facebook like button is on my own domain, in my own code.
This is not possible without user permission. You need to ask the user for the user_likes permission as documented here.
I'm trying to get a user to 'Like' a page via the SDK. User is signed in and I get a valid access tokken form the cookie. My APP has asked for permissions read_stream and publish_stream. I can successfully do things like post to their wall, etc. But when my APP tries to 'Like' a page, I get the error back:
OAuthException: (#3) Application does not have the capability to make this API call.
Am I missing some other permission, or is there a setting I have to turn on in my APP? I'm at a loss here.
You can't like a Page on behalf of a user (Bugzilla discussion). You can, however, like posts, comments, and photos on behalf of a user.
Edit 7/9/2012
Since bugzilla no long exists, the bug linked above is inaccessible. Google doesn't have a cached version of the page, so I ran another search. The best thing I could come up with was this Google Code Discussion regarding the ActionScript API.
Facebook makes brief mention of Publishing likes via the Graph API in the documentation, but doesn't say one way or another whether you can like a Page on behalf of a user - just "Objects" which (probably arguably) are not "objects" in Facebook-lingo.
My thought is, the API to like page is available, but is only offered to white listed applications (such as, the Facebook iOS and Android applications) written by "special" publishers. There's obvious reasons why Facebook wouldn't want/allow developers to create like connections on the graph. It would be taken advantage of by spammers and other nefarious developers and would deteriorate the meaning of what a "like" represents for a page on Facebook.
My guess is, you'd have to make a pretty strong case to Facebook about why you need/want access to the Page's Like connection (for publishing) before they'd even consider giving you access. I'd also guess that they'd want to verify that you're doing only user initiated like creations (in such a way that the iOS application would handle it) so as to protect the reptutation/meaning of a "like" action.
Actually this is NOT true, but you have to do a complicated Javascript / UIWebView process in order to display a Facebook 'page' of JUST the like button on your view, and this like button you can configure in the JavaScript / Objective-C (using string replacement) to be any Facebook page url you like.
Facebook's platform policies don't allow for a web-based like button aside from using the officially supported options
Those options doesn't require using OAuth or the Open Graph api. However, facebook just added support for mobile apps to send like actions through opengraph.
I'm not sure if they intend to allow sites to customize their like buttons or just apps...
Liking works for me with the iOS SDK using the graph api:
https://developers.facebook.com/docs/opengraph/actions/builtin/likes/
I can't seem to find exactly what I'm looking for. We're trying to build an app to run solely on a Facebook Page. We want to show a landing page if they don't Like the page, and the contest entry form if they do. This functionality works.
Before showing the contest entry form, we'd like to authenticate the user viewing the app so that they can just hit "Enter the contest!" and we can automatically pull a name/email address.
Any of the methods of authentication I've seen described, including through the Facebook Developer docs, don't work at all.
I saw something that said they need to interact with the app first, then you can get the id, but that doesn't work either. I also don't get the page id passed with the signed request.
Its also pretty unclear whether I should be using an iframe or just FBML.
Could anyone point me in the right direction, please? Thanks!
You need to create a fan page and add the FBML plugin to that page, then you will need to insert a short code that will determine if a facebook user has clicked 'Like' or not and by determining that you will decide weather to display the content of the landing page or not (using an iframe). You will probably like to also set the FBML box that you create as the default view for members who didn't press the 'Like' button yet, you can change the default view in your fan page settings.
On the iframe, you will need to use the Facebook API if you want to retrieve any user information from Facebook, for that, you will need to register a new application with Facebook. Go to developers.facebook.com for the API integration and app registration.
Also, what do you mean when you say:
Any of the methods of authentication
I've seen described, including through
the Facebook Developer docs, don't
work at all.
Well, it appears you can't do it that way. The client was very specific in wanting that functionality but we ended up convincing them to go for a redirect to the canvas page to have the app authorized and the contest entered instead.
i've built a survey and at the end i want the users to share their result on their facebook wall but i'm finding it hard to find any examples or reference.
something like;
<div>
[ image/graphic ]
"I've just completed survey XXX and got 90%"
<a>post on my wall</a>
</div>
any help appreciated - even if its just terminology i can look up!
Start here. Basically, you're creating a website which you want to integrate into Facebook. To do so, your users will need to "login to Facebook" from your site (unless they're already logged in, such as in another browser tab) and allow your site to perform certain actions on Facebook on their behalf.
The Single Sign-On part is where you will initialize your website as a Facebook application (you'll need to create the application on Facebook first) and provide a login button for your users.
Your login button can be set up to ask the user for specific permissions to act on their behalf with Facebook. I think the one you want is publish-stream but I'm only barely familiar with it, play around with the functionality and see what works best for you. Your users will be presented with a pop-up div stating that your website (or application) is requesting these specific permissions and they have the option to allow or deny. An example can be seen here.
Once you have the user's permission, you make use of the cookie (demonstrated using PHP back on the Single Sign-On link) to gain access to information by use of the Graph API, the JavaScript SDK, Social Plugins, etc.
you should use the facebook api.
Get the "publish_stream" right of a user and use the "api" method of the connection object (with parameters like : '/userid/feed', 'post', array of informations about the post).
I can't find the right code and the official document is not always up-to-date.
OR
Just add a facebook "share" button on your page that uses "meta" markups. You should find examples on about 80% of websites.