Add comment via API as company page - facebook

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)

Related

APP/API creation for page in Facebook Business manager?

I am new to business manager as all of the pages I manage I have created myself. I have said I will look after a page for someone and they have granted me access, thus the page appears in my Business manager and I can make changes.
What I need to do is create an App/API connection to link the page to the website, is there anyway to do that without logging in through the customer's personal account or asking the customer to create the app?
The App needs to allow the website to autopost status updates.
Regards
Donna
For posting status updates with the API, you need to do the following:
Authorize someone who can post "as Page" with the manage_pages and publish_pages permission
Get the Page ID with the following API call: /page-id?fields=access_token
Post by using the resulting Page Token with this endpoint: /page-id/feed
...of course you need an App for that.
More information about Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/

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

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,...

Graph API v2.2 : user_status permission is obtained from facebook but still cant get the v2.2/me?fields=statuses data

I have an app & user_status permission is obtained from facebook after its submitted for review. I can get the v2.2/me?fields=statuses data for the App's admin. No other fb accounts are able to get this data. When I login with facebook from my portal, the permissions requested are not shown to the users.
Is the issue related to FB API. I can use the obtained permissions only for the App's admin alone?
Is this issue related to not obtaining consent from the account while logging in from my portal. If yes, what is the method to get this done.
Anyone kindly help me regarding this.
It's all in the docs:
https://developers.facebook.com/docs/apps/review/login#do-you-need-review
...your app's developers will be able to see, and grant, any permission without requiring review by Facebook.
and
People who are listed in your app's Roles tab will have access to extended permissions without going through review (e.g. publish_actions or manage_pages). For example, if you use the Facebook Plugin for Wordpress to publish your blog posts to your Facebook Page or Profile, you do not need to submit for review so long as all your publishers are listed in your app's Roles tab.

How to revoke a given Facebook token?

I'm using OAuth authentication to obtain a token from a Facebook user. My application edits - among other stuff - their Facebook pages. With that token I obtain a permanent token.
The user can unlink its Facebook account from my app. When a user does so, I like to invalidate the token and remove my app from the users apps. It this possible?
Have a look at https://developers.facebook.com/docs/facebook-login/permissions/v2.0#revoking You can use
DELETE /{user-id}/permissions
to revoke a user's login to your app.
Furthermore, there's a section in the app's -> settings -> advanced screen where you can specify a so-called "Deauthorize Callback URL". This URL will be called by Facebook if a user actively disconnects your app from his profile settings. Unfortunately I can't find any docs on Facebook concerning this anymore. But there's a question about that here on SO: Facebook user deauthorizes the app
#tobi solution didn't work for me, I had to pass the access token.
DELETE /{user-id}/permissions?access_token={access_token}

Login the user with Facebook without revealing the APP ID

In the Facebook documentation about Login the user with Facebook APP they say:
"Because it requires you to include your App Secret you should not attempt to make this call client-side as that would expose this secret to all your app users. It is important that your App Secret is never shared with anyone".
I understend it is about APP Secret, but what about the Developer ID?
The developer ID is added in the URL address of the window for login the user with Facebook:
https://www.facebook.com/dialog/oauth?client_id=APP_ID&redirect_uri=...&state=...&scope=...
The APP_ID can be copied and used by anyone.
I tryed with JavaScript SDK, and with PHP SDK, but in both cases the developer ID appears in the address bar.
I tryed also the get and display the page from that URL address using cURL, but of course not works.
Is there any way to login the users in my web site using Facebook, without revealing the developer ID?
Or, it doesn't matter if someone uses your Facebook APP ID?
you could try using iframes? not a very good solution for the problem because it's still very much available but at least it's not in the address bar.
It doesn't matter, this is essentially public information.