How to get Facebook permissions for app - php

I'm trying to get read_stream and rsvp_event permissions but FB's staff continue rejecting my submissions .. Why is so tricky retrieving permissions for a simple app?
I just need to read my status messages and events and display it on my website.
How do you create permissions submissions for your FB apps?
(I use graph api on my php site)

This is from the docs at https://developers.facebook.com/docs/facebook-login/permissions/v2.1#reference-read_stream
This permission is granted to apps building a Facebook-branded client on platforms where Facebook is not already available. For example, Android and iOS apps will not be approved for this permission. In addition, Web, Desktop and TV apps will not be granted this permission.
So, it's very unlikely that you get this permission approved.
Regarding the events, I think user_events would be the right one: https://developers.facebook.com/docs/facebook-login/permissions/v2.1#reference-user_events
As I understand this is only for the use on your personal website, why don't you generate the Access Token for your user manually via the Graph API Explorer, prolongue it and store it somewhere in your PHP script? You'll need to update the Access Token every 60 days manually as well, but this I think the most pragmatic option you have.
See
https://developers.facebook.com/tools/explorer
https://developers.facebook.com/docs/facebook-login/access-tokens#extending

Related

Facebook Graph permissions incorrect

I'm trying to update my code to work with the FB Graph 3.0.
The login flow works fine, and I request my permissions and the user grants them. The later bit of PHP code that uses the PHP SDK is meant to post to the user's timeline.
$r = $this->facebook->get('/me/permissions');
$result = $this->facebook->post('/me/feed/', $fbpost);
If I examine $r, I can see that I have the permissions required:
manage_pages: granted
publish_pages: granted
public profile: granted
pages_show_list: granted
Yet when it makes the actual request, it fails with an error: (#200) Requires either publish_actions permission, or manage_pages and publish_pages as an admin with sufficient administrative permission
When I attempt to add the publish_actions grant to my login (using the javascript library) I get an error that it's invalid: Invalid Scopes: publish_actions. despite FB's own documentation showing this exact scope in several example.
Can anyone point out what I'm doing wrong?
EDIT: I'm not all that concerned with the publish_actions scope having changed, though I understand that may be a new change that isn't in the docs-- but I do have the manage_pages and publish_pages permissions, yet I still can't post to my timeline, and the error code seems to say that those permissions are not set.
As explained in the FB v3.0 API /me/feed endpoint documentation you need the user_posts permission (which isn't listed in your granted permissions) to read and publish on this endpoint. Publish_x permissions are only related to pages and group, not personnal feed.
Also check the board of your FB App if there are no review alerts, with the recent changes in legislation (GDPR ...) and Facebook issues (Cambridge Analytica etc...) a lot of changes has been made in the API.
I'm not a FB API expert, however, Twitter recently removed the ability to post automatically to FB-- my assumption is that this automated posting to a user's timeline is no longer possible in the latest FB graph API. At least, it takes a lot more hoops to jump through than a 3rd party developer can expect a non-technical customer to handle.
https://help.twitter.com/en/managing-your-account/link-twitter-to-facebook

Revoke access of microsoft/outlook account using outlook or graph rest API

I'm using Microsoft Graph API for integration of microsoft/outlook calendar in my app.
API reference is here
I want to revoke user's access of their calendars from my app but didn't find any way to do so. I tried with following api but no luck:
DELETE https://graph.microsoft.com/v1.0/users/{user_id}
Well, that command would delete the user entirely. So while that would certainly remove them from the calendar, I'm guessing this isn't the outcome you're looking for. :-)
If you're looking to remove the permission for your app, there are a couple of ways to trigger this:
Simply stop requesting that user's calendars from your app. This won't revoke permission to the calendar however so this likely isn't sufficient.
Drop Calendars.Read and Calendars.ReadWrie from your list of requested scopes.
In order to ensure this change is reflected in the user's account, you'll need to re-authenticate the user with the query param prompt=consent auth URI.
Have the user revoke permission for your application entirely. This is done by visiting https://myapps.microsoft.com.
There are certain apps that a user cannot directly revoke. These are apps who were granted access at the organization level. To revoke these, an Administrator will need to do this in the Azure Portal.

Facebook manage_groups permission

Is there any update on the ability to manage Facebook groups through the OpenGraph API. I am trying to delete members from my group using the API but I need the manage_groups permission.
Whenever I try to add it I get an API error stating it doesn't recognize it.
Has anyone had any success getting this to work?
Try using the permission "user_groups" and in automatically grant the manage_groups permission
user_groups permission to retrieve any groups that the session user is a member of.
The user_managed_groups permission can be used to read the group content for a group in which the user is an admin. This permission also allows the app to post as the user in the group if the app is also granted the publish_actions permission.
https://developers.facebook.com/docs/graph-api/reference/v2.3/group
The bad new is that faceboook will request you a submit a review and
it doesnt allow that permission for almost anyone platform. I made an web app with PHP and when i sent the review they refuse that permission with following answer:
The user_groups permission is only granted for apps building a Facebook-branded client on platforms where Facebook is not already available.
For example, Android and iOS apps will not be approved for this permission. In addition, Web, Desktop, in-car and TV apps will not be granted this permission.

how to get manage_pages permission automatically

my company have about a hundred of facebook app and more than 200 facebook pages.
My job is to get via FQL insights all statistics about applications, pages, and domains.
After many tries it seems my code don't work because my app need to have "manage_pages" permission from all facebook pages administrators, because my apps need to impersonate them.
Even if I can contact directly my administrator they need to authorize all my applications for every page one by one.
So I think I have to write a php page able to automatically get authorization from administrators for all pages under their responsibility.
Please consider, I'm able to have a list of all pages id and app id.
Does anyone please suggest me how automatically let applications to get manage_pages permissions in a straightforward way?
Do you know if there are PHP examples?
Thank you for your time
You could do it by automating curling through the login screen. When you go after an authorization token the user is required to enter credentials via a login screen. If you have user/pass words you can curl through it I suppose. While your getting permissions make sure to get the offline access permission too, so that you receive a persistent token that can be used when the account is not logged in. Good luck.
Edit: The last time I did this, I kept notes on the whole authentication process if you want a copy PM me and I'll email them to you. They are step-by-step getting authorization tokens to write to a fan page.
Use the JS SDK to login the admins into your app, with the offline_access and read_insights permission.
The read_insights permission will allow you to access the insights for each page and application.
The offline_access will give you a permanent access_token that you can use to update the insights without having to wait for the admins of the pages and apps to log-in again.
Store the insights in a database, so you can keep the insights in memory without having to query the APIs all the time (it's time consumming)
It's basically what Social-Insights is doing (http://insights.social-insights.net/) and it's workign pretty good.

Facebook PHP SDK - Remove/expire permissions and app from a user's profile

I'm currently working on adding Facebook integration into a website of mine via the PHP SDK. I'm requesting and planning to use the offline_access permission so I'm storing the access_token in a database. However, I'm giving the user the option to remove the integration with Facebook after they add it and therefore then removing this access_token from the database. This is where the issue comes in:
The first time they add the integration, my app redirects to Facebook correctly and asks for the permissions, etc. Then, however, if they remove the integration and then re-add it, it doesn't ask for the permissions again (which makes sense since those permissions are still technically given to my app on that user's profile unless they went into Facebook and manually deleted them).
My question is if theres a way to tell Facebook to remove my app and its permissions from that user's Facebook profile so that if they go to re-add the integration, they are once again prompted to accept the permissions.
Perhaps something like $facebook->expireAllAppPermissions() I guess.
You can issue an HTTP DELETE request to /PROFILE_ID/permissions to revoke authorization for an app.
this is because you are just deleting access token from your data base , it will not remove your app from user profile. user is still authenticated with your app. he has to remove the app manually.

Categories