Do review required if we want to get Facebook Page like count (Without Facebook login) by Facebook app token? - facebook

I am doing a static web page in my website, in which I am showing the like count of particular Facebook page. There is no kind of login required to see this web page. Also, I don't want to user to login with their Facebook account to see the Facebook page like count.
I have implemented this requirement by using Facebook app token.
API: "https://graph.facebook.com/PAGE_ID?access_token=APP_TOKEN"
But the problem here is, If I use the app token of already approved app by Facebook with some permissions (manage_pages) exists, it works. It is not working for the app token of newly created Facebook app.
I have sent the app for review to Facebook by requesting manage_pages permission, but they rejected the app and said that my website doesn't have the Facebook login functionality implemented.
Since it is not documented clearly, I have a doubt that do the app need to send for review if I want to get the Facebook page like count without Facebook login (By using Facebook app token)? If yes, what permission do I want to request?
Any help would be much appreciated.

First of all, you need to learn what Tokens there are:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
For your problem, you can just use an App Access Token. There is no need for any permission or Login Review, the links above tell you exactly how to create one. Make sure you never use the Token on the client, especially because it includes the App Secret. Do the API call on the server only (file_get_contents or curl, if you use PHP).
If by "it does not work" you mean that you only get the id and the name, then it´s not about "not working", you need to read the changelog and search for "Declarative Fields": https://developers.facebook.com/docs/apps/changelog#v2_4
So if you want to get more than just id and name, the API call would be like this: https://graph.facebook.com/936299239766048?access_token=YOURAPPTOKEN&fields=id,name,likes,...

Related

How to create feed using admin account without submit app - Graph API

I'm trying to publish a feed. I receive an error
The permission(s) manage_pages,publish_pages are not available. It could because either they are deprecated or need to be approved by App Review.
After I take a look at their example for app review, I see this.
In my understanding, I think this mean I do not need for a app review if I use admin user access token. Correct me if I am wrong.
As I am the only one who will publish feed on my page, I try to set the access token to my admin account access token. But, I receive another error
(#200) Unpublished posts must be posted to a page as the page itself.
Is that mean the only way I can do is to submit app review?

how to request permission to post ads on a page as an app?

I'm working on a facebook app that posts newsfeed ads, and I have been banging my head against the wall for the last few days, the work flow should go like this:
User provides his page id.
The App requests authorization to post ads on the page. stuck here
App verifies that the user authorized it.
App creates adcreatives using the user's page_id in the object_story_spec call to /adcreative using the app's ad account.
I went through How to post to page as an app?'s docs, couldn't figure it out.
the app is written in Go, however if you can provide a code sample it doesn't matter what language you use, I just need the basic work flow.
Not sure what you want to do exactly, but if you want to create ads (for am ad_account/user) via an app, you'll need the ads_management permission during Facebook Login.
How you manually create a login flow can be found in the docs as well.
See
https://developers.facebook.com/docs/facebook-login/permissions#reference-extended
https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow

Programatically log in to facebook and post from server side

I want to connect my web application with the facebook business page. Each time I add a new product to the page I want to post it on facebook wall. I have a facebook application and the page owner username and password. Can I automatically authenticate with the user, pass to facebook and send the post request from server side only? Usually I am logged in with another facebook account when I add products. Also I would like to post when another page user add a product.
You can post to Facebook as a facebook page using the manage_pages permission. You'd need to obtain this permission from a user who is an administrator of the page. There are a few steps to the process, here is a basic summary:
Get an access token from a user who is an administrator of the page
and has granted "manage_pages" to your app. read about authentication
here: http://developers.facebook.com/docs/authentication/
using that access token, make a graph request to
https://graph.facebook.com/me/accounts?access_token=USER_AUTH_TOKEN
You'll get a json response containing all the pages the user administrates, containing their name, category, facebook id, and an auth token - this is what you'll need to post to that page
you can then use this access token to post to the specific page using
https://graph.facebook.com/PAGE_ID/feed?message=POST_MESSAGE&access_token=AUTH_TOKEN&method=post
I just found this blog post which gives you a pretty good explanation
http://developers.facebook.com/blog/post/465/
It sounds like you need the 'offline_access' extended permission.
It is scheduled to be deprecated. Take a look at the following link for more details:
Deprecation of Offline Access Permission
I'm not going to pretend to be an expert on this, but I do NOT recommend trying to login through Facebook's user interface and perform POST requests/HTML scraping on behalf of the user. That procedure would grant you far more functionality than is possible through the Graph API; I don't think Facebook would approve of this.

Add comment via API as company page

Is there any way to comment some object on facebook as company page (not from personal account)? We have comment.add method, but I'm not able to give permissions for my app from company page (I have to switch to my personal profile). Any ideas?
Yes you can, you'll have to get an app access_token and use that token when making the post. You can read more here - on the Facebook Authentication Documentation for more information about how to retrieve your app access_token. (Scroll down to App Login)

How to create an access token?

I am a bit confused about the facebook graph api and access tokens.
I have created a facebook user and a facebook page. Now I want to write an application that lets the user post a message on the pages wall/feed. As far as I understand it right now I need an access token of the user to post a message to the pages wall. To create that I need an app id and app secret. But there is no app, there is just the page and the feed. Do I have to create an app? And how would I connect the app to the page without creating a new tab on that page?
In order to do anything whilst acting as a user, you're going to need an App and the correct permissions from the User. Read more about Authentication here