Facebook API - getting events from restricted pages - facebook

I want to make an events calendar using Facebook API. I have an array with page URLs I want to scan and take its events. The problem is, I am using an App Access Token and I can't obtain events from pages with restricted age (alcohol pages etc.). Is there any way I can obtain those events?

There is no way to access restricted Pages with an App Token. You have to use a User Token of a User who can access the Page, or a Page Token of that Page. There is no other way, or the restriction would be pointless.

Go to the advanced settings of your applications page on developers.facebook.com. e.g. for me it would be https://developers.facebook.com/apps//settings/advanced/. And set app restrictions for 'references alchohol' to yes, similar for age.
Screenshot of setting attached

Related

Facebook and Instagram public data API

I want to build a dashboard that enables any company to track the social media activity of its competitors.
For example.. let's say you are a small business owner. You would be able to add the 'facebook/instagram page id's' of your 4-5 competitors within the app. The app would retrieve the historical data of your competitors.. and enable you to interactively explore what they are doing. How often they are posting, at the time of the day, what is liked/not liked, etc.
Problem is: Since Cambridge Analytica, Facebook requires app review to allow access to public page data. But how do I show the app.. when I don't have the data to build it?
Does anyone have any remote idea whether the thing that I am trying to build is generally within that would be considered permissible by Facebook?
You can still make your dashboard which will show your Facebook activity.
To get the Facebook page ID of 4-5 competitors. The competitors have to use your app and allow permission to your app for accessing public features.
You have to own a Facebook page. Get OAuth key. For every request to Facebook you will be using this Key. In case of mischievous activity your OAuth key will be blocked.
What you are trying to do is not possible these days and neither permissible by Facebook.
You can build your App already and just use your own Pages for testing - with a Page Token of those Pages. Send Facebook a video how you are using the data in the review process. I have recently got Page Public Content Access approved for that specific use case. Facebook just wants to see how you will use the public content, the App does not need to be 100% finished.
What´s allowed and what´s not allowed: https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS

Can I access a Facebook Page with the Graph API without creating an app?

In the past, I think a Facebook Page access token could be generated manually, and then used with the graph API to query posts, comments, likes, shares, etc. Now it seems you cannot query anything without developing an app that I login to and then in turn the app generates the access token. Is that true? For example, this question from 2015 claims no access token is needed for public data, but when I try their example it returns "An access token is required to request this resource."
I'm the admin of my page that ran a basic contest (giveaway). I'd like to use the graph API to fetch the names of people that liked, shared, or commented on a post. Then I want to cross reference it with those that like the page. Do I have to register and develop an app for this? Does my page have an access token available without going through the app registration and review process?
Can I access a Facebook Page with the Graph API without creating an app?
No, that is not possible. You always have to use an App for any API Access.
Then I want to cross reference it with those that like the page.
That is not possible either, not even with an App. I assume you want to make sure that participants like your Page - which is not allowed. People cannot be "incentivized" to like your Page.
Platform Policy: https://developers.facebook.com/policy/
Explanation about the specific rule against requiring people to like your Page: https://developers.facebook.com/docs/apps/examples-platform-policy-4.5

Location restricted Facebook apps - Possible to restrict view from page admins?

We have created a Facebook application that is restricted to US only, using the Graph API location restriction method (https://developers.facebook.com/blog/post/574/).
This application has then been added to a Facebook page. However, it appears that admins of the page are still able to see the application, regardless of their location.
So our question is: would it be possible to disallow access to admins of the page if they are outside of the US?
Just to make sure, is it admins, or just because you are the owner of the app.
I have no experience with the restriction functionality but if the above still proves that page admins can view it, then it looks like page admin's can still view it. But there are some other steps you can apply considering people can easily fake location on Facebook anyway.
IP Location
Download GeoIP (free IP address database) and you can lock people out of your app that way as well.
Graph API
Connect to the graph API with their user Id, manually get their location and block based on that.
Or you can use a combination of all of the above.
This is completely intentional - page admins will always see the tabs on their page - there's no way to hide content on a page from the admins of that page.
Broadly, there should be no way to hide content from users who are responsible for that content

Hide a Facebook tab based on user's location

We're developing a Canvas app that will have a tab when implemented on the fan page. The Tab will have the like gate. What we want to do, is restrict access based on location. So, Facebook users outside of the US wouldn't see the tab when the go the fan page.
This blog posts speaks to showing users different content based on location (http://developers.facebook.com/blog/post/394), but i don't want them to see the tab at all.
Any thoughts?
To set demographic restrictions (i.e., location, age, etc.) issue an HTTP POST with an app access token to
https://graph.facebook.com/APP_ID?restrictions={“RESTRICTION_TYPE:VALUE”, …}
ie:
https://graph.facebook.com/APP_ID?restrictions={"location":"US"}
Users who do not pass the restrictions will not see the tab.
More information at: Facebook Developer Blog & Graph API: Application.
When an application is accessed as a Tab on a Page (iFrame) Facebook Passes a signed request (http://developers.facebook.com/docs/authentication/signed_request). You would be able to use that data to get the user's location. However, it might need further authentication to get that information.
Please refer to this question for a hack to find the user location through their IP:
Getting user location on Facebook page tab
Anyway, as far as I know, you cannot remove the application all together, you have to show up 'some content' for the users who load the tab. I suggest that if you want to restrict page content to use the country restriction for the entire page. However, it might be impractical for your use case.

Can I access Facebook API's without an api_key?

Is it possible to access Facebook APIs for logging in a user, or to allow a user to become a fan of a fan page through a third party site, without actually creating an app on facebook?
Why don't you create a fab page directly for users to become fans for that page? And as far as i know, you can not access facebook API without API key.
You can't access the API without creating an application and getting an API key. There are a small number of API queries that will work without the user having added an application or even interacted with it but they generally on retrieve very basic data.
There's certainly no programmable way of making a user a fan of a page without using a fan box widget or having them do it directly through the site. This is because the post_form_id value which Facebook uses for these kinds of interactions is only present on pages served from facebook.com and is never accessible to the developer. To allow otherwise would open up the system to all kinds of exploitation.
I've no idea what problem you're trying to solve anyway. Creating an application API key is no hardship (and it doesn't have to be an active application for session-less queries - just create an app and grab the keys) and the fan box widget can be styled with CSS, as long as you follow the basic rules that Facebook has set out.