I want my application to have two spare screens, one for the non Fan user (the ones that didn't press the button like) and one for the fans. How can I do that without asking the users to authorize my app? Do I have to use pages or page tabs first? or something else?
I tried with JS SDK and $_REQUEST["signed_request"] but there is no info if the user "likes" the app. I also tried FQL methods, but the most tables ask for the user_likes permission.
I'm totally lost with that and any help would be gratefull.
You can get this from the signed_request parameter, which is added to the request URL for your app on the page tab or canvas URL you provided. The signed_request param contains JSON data which includes the id of the page your app is installed on, and an additional liked field if the user has already liked the page. You can use this field to redirect users to the appropriate view for your app.
See the section labelled "Integrating with Facebook APIs" at https://developers.facebook.com/docs/appsonfacebook/pagetabs/ for more info.
Related
I use "html static iframe tab by woobox" to create a fan gate.
The fan gate shows differnt pages for users who liked the page, and another page for non-likers.
I have two aspx pages on my server one for likers and one for none-likers.
For the likers page whitch has an Iframe I link my first webpage.
In this webpage i want to get the facebook userid that is currently in the likers page.
Do I have to create an application in order to get the userid?
Do i have to get the user permission?
How do i use js sdk to do it?
Thanks
Yes, you have to create an App to get the User ID, and the user must authorize your App. See here for further information about login with the JavaScript SDK: https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.0
But keep in mind that you will NOT get the real User ID, Facebook made some changes recently and you can only get an "App Scoped ID" - see the Changelog for further information: https://developers.facebook.com/docs/apps/changelog
DonĀ“t worry, the App Scoped ID will not change, even if the User deauthorizes and authorizes your App again.
I have a client who wants to have the user liked his app before asking for permissions.
For users not having defined advanced security settings in their profiles this is possible, but I have occasions that I must ask for user_likes permissions to get that info so this is a dead end.
One solution could be to have my own like button in the page and register FB.event.subsribe to collect the info, but because the app will be used in a page tab (where a like button is already displayed by FB on top) this would be ugly and confusing.
Any ideas?
Within a page tab app, you get the info whether the viewing user liked the page already or not in the signed_request. (Since it is POSTed to your app on initial load into the iframe, you can only access it server-side.)
For how to parse it, see here: https://developers.facebook.com/docs/facebook-login/using-login-with-games#parsingsr
(If you are using the PHP SDK, that has a method to get it parsed implemented already.)
I am adding my Facebook application to Facebook Fan pages through the Facebook Javascript add_to_page dialog. Every thing is working Fine, only the problem with unpublished Facebook pages.
I am retrieving the Facebook pages IDs of all the pages to which the app is added. If a person add it to such a FB page which is unpublished, I can't get the Page ID and app is still added to the Facebook page. I want to prevent the app to add to the unpublished page in case.
The Facebook developer documentation provides no help regarding this issue.
Thanks in advance for taking your time.
All the pages a user administers will appear in the dialog - there's no way to prevent an unpublished or otherwise restricted page from being selected - if you have manage_pages Permission from the user you can act as all of their pages, including the unpublished pages.
If you don't, and need to know which page your app is being loaded on, the signed_request sent to your app when the tab is loaded will include the page ID
Can someone explain to me how to use facebook app_data which is part of the signed request?
http://developers.facebook.com/docs/authentication/signed_request/
The documentation is vague. I can't figure out how to actually use the app_data field. I want to be able to pass the app data to the app when it is added to a page so that the content displayed on it is relevant to the Facebook page.
for example I want a user profile on my site to only be displayed on that users facebook page. To do so I want to send the user ID to the fb signed request when the user adds the app to their page. Then anytime the page is visited I will pull the app data and run some php to display the correct profile.
Can I do this with the app_data or is this not possible?
From the documentation that you have cited
App Data is
A JSON string containing the content of a query string parameter also called app_data. Usually specified when the application built the link to pass some data to itself. Only available if your app is an iframe loaded in a Page tab.
So app data is useful only when your application has generated a link that some user will click and follow through to your app on some Facebook page.
And if a user is visiting some page (and the app tab) directly, then you won't get the app_data field.
Once a user has installed your app (and has given your app minimum permissions) on any one of their pages, you always have the page_id and user_id fields in the signed_request that Facebook will send to your app, both in canvas apps (no page_id field) and page tab apps.
For what you want to do, you can just read the signed_request and then find out the page_id and display data accordingly, you do not even have to use user_id.
Hope this answers your question. Do ask for clarifications, if required.
I'm building an iframe Facebook application and I want to set up a 'like gate' where a user has to like my page to continue past the opening of the application. (After they click like I allow them to click a 'continue' button using JavaScript).
Is there any way to detect if a visiting Facebook user has liked a page without first forcing them to authorize my application? I know I can query their likes using the graph api or fql but I'd like to avoid forcing them through the auth dialog for this one part of the app. The reason I ask is that I've seen some applications on Facebook that appear to allow this functionality.
For example, this page:
http://www.facebook.com/velcrobrand?sk=app_156218351098324
I don't have to authorize the facebook application but the page knows if I have liked it or not.
I've made some progress figuring this out.
http://www.chilipepperdesign.com/2011/02/15/reveal-fan-gate-like-gate-facebook-iframe-tab-tutorial-with-php
The method described in the above link only works if the page is loaded inside a tab of an application fan page and NOT the applications primary iframe page.
Here: 'pages' object is present
http://www.facebook.com/apps/application.php?id=249709505050393&sk=app_249709505050393
Here: 'pages' object is not present
http://apps.facebook.com/flipkey/
Not sure why this is but I think I have enough to move forwards and create my fan/like-gate.