get the facebook user id in fan page using js - facebook

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.

Related

Facebook App Review Page Public Content got rejected due to bad screencast

I want to create a website where users can like one-another's Facebook page posts and get points. After getting points, they can use these points to add their own Facebook page post. When users want to add their post from their page, they select their page and all their posts are displayed so that they can easily choose which post to add. For this purpose, I made use of the Page Public Content Access feature. However, when I submit my app for review I am getting the following:
Not Approved
Your screencast doesn't show how the use of this permission directly improves the user experience in your app. Unfortunately, we also weren't able to determine this from testing your app manually.
All permissions data must be visibly used within your app. We do not accept permission requests for data that you may decide to use later.
Please see our Examples page to learn more about making and submitting a successful screencast.
Learn more about testing permissions prior to approval.
but I can't find what is wrong with my submission. I would be glad if you can help. This is how my submission looks like:
Tell us how you're using this permission or feature
My app is for new starters who want their Facebook page to address greater audience. In this app, users can earn points liking posts of one-another's Facebook pages and use these points to advertise posts of their Facebook Pages. I use Page Public Content Access to help people choose post from all posts that they shared in their Facebook Page. They choose post that they want to display in my website and in this way this post addresses greater audience. First, user chooses his or her Facebook page which the post belongs to, then, all the posts of this Facebook Page are displayed using Page Public Content Access, so that they can choose easily. They choose the post that they want to add to website.
Demonstrate how your selected platforms will use this permission or feature
1.Click Login in Home page
2.Click Facebook and Login your Facebook
3.Confirm your Username
4.Click Facebook in navbar and Choose "Add Post"
5. Choose your page in which you shared the post
6. Click "Choose Post" which will display your posts where you can select the post which you want to add to the website
7. Choose 10 Points and click Add Post
MY SCREENCAST VIDEO:
https://youtu.be/cFTXz8o5cqo
EDIT: I am using page access token:
PICTURE SHOWING THAT I AM USING PAGE ACCESS TOKEN

Handling Unpublished page in Facebook add_to_page_dialog

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

check if user likes a page without application perm request

I have a simple tab page, php sdk working and I know I can get the "like" for this specific page from the user signed_request.
This page is a colaboration with another company who also has an FB page. What i´d like to know is if I can get the like status of their page for the current user so I can authorize an action on this tab that is dependant of the user liking both my page and my partner´s.
Is this possible without using an actual app, an access_token and the appropriate perms requested?
e.g. my page is fb.com/Coke and my partner is fb.com/Target
On this specific tab page I want to enable a button only if me (Coke) is liked (which I can get already) and if my partner (Target) is also liked.
I tried the graphAPI (me/likes) and FQL (using the connection table) and both compalin of an unauthorized request.
Short Answer:
No, this will not be possible in a production setting.
Further explanation:
Some users have their list of likes as public. In that case, it would work.
But in order to get likes from a user that has that setting as anything but public (such as myself, only friends of friends can see it), then it requires an app and an access_token that has a user_likes permission.
From the documentation:
Permissions Required:
user_likes permissions if querying the current user.

Fan and nonFan pages for my app

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.

Facebook Facepile users liked vs connected

I noticed that the Facebook Facepile plugin shows my friends who 'Liked' the page on some apps while it shows my friends who 'Connected' to the app on others.
How do I choose which one Facepile shows?
I am aware that I can assign a custom action to Facepile. If I want to show friends that have connected/authorized the app, does that mean I need to create a new action called "connect"?
According to the facepile social plugin documentation:
https://developers.facebook.com/docs/reference/plugins/facepile/
To display users who have liked your page, specify the URL of your
page as the href parameter. To display users who have signed up for
your site, specify your application id as the app_id parameter.