Auth0 Facebook user_id and access_token - Retrieving page_id - facebook

I have a React application where I'm able to link accounts from different social medias to the main username and password account. I linked my Facebook account where I manage several other page and I assumed that with the user_id and access_token that comes back from Auth0 I'd be able to access my pages but I haven't been able to do that. Does my Auth0 app need to be reviewed by Facebook before I get access ?
When I go to the Graph API Explorer, paste in the access_token from Auth0 and try to access ${user_id}/accounts, I get the following Debug message:
The field 'accounts' is only accessible on the User object after the user grants either the 'pages_show_list' or 'manage_pages' permission.
even tho I clearly granted those permission on Auth0->Connections->Social.
What am I missing here ?
Any push in the right direction would be greatly appreciated.

Related

Facebook get profile link after OAuth2 login

I use OAuth2 login through the Facebook social network for users on the website.
Is it still possible to get the certain user's Facebook profile URL after login(for example by accessToken) or Facebook hides this information right now(after incidents with data leaks) and it is impossible?
It is, if the user grants permission.
You need to ask for user_link permission on login, and then you can request the link field of the user object – that will return a URL that can be used in a browser, to redirect to the actual profile.
This URL contains some form of token, and likely has limited validity - so you should not store those for long-term use, but rather request a “fresh” one when it is needed.
https://developers.facebook.com/docs/facebook-login/permissions#reference-user_link

Facebook graph api

I created a facebook app to get all the images my page is tagged in. It includes the following steps.
1 Get user access token with manage_pages,... permissions
2 Get the page access token from me/accounts endpoint
3 Get the photos using me/photos/tagged endpoint using access token i got in step 2
Every thing is working fine when in choose application as "graph api explorer" in the graph api explorer.
But when I select my application. It does not show me the images by other people in which my page was tagged.
Is there Something I am missing? Please help
Thanks
Your app needs to authenticate the page access token with the "manage_pages" permission for this call to work. To obtain a page access token you need to start by obtaining a user access token from the admin user of the page and ask for the manage_pages permission from your app when the user authenticates (logs in with your app). This document goes into details on how you can implement the flow I described above : https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens

Unable to get Facebook user age_range

I have a portal which has the following functionality to comment on FaceBook posts:
1. When a user chooses to a comment on a post, FB credentials of that specific user are requested.
2. When that user signs in with FB credentials my FB app asks for public profile permission.
3.When I use the access token of the same app in the graph explorer it does not return me the age_range of the users (irrespective of whether they are logged in or logged out of FB) who have approved/not approved my app.
4. I have checked for the public_profile permission even on the access token as well, using the debug feature in graph explorer but still I'm not getting the age_range.
Can anyone tell me step by step procedure to get the age_range of a user?

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.

facebook opengraph login

I have a question about facebook login on my website. What I have now is simple login process which logs in user but each time facebook asks user to grant my app an access permission.
It looks like this:
1) user clicks "login with facebook" and is sent to facebook. He/she gives permission to access his/her account
2) I receive back an authentication token for this user
I'd like to have the following flow:
1) when user clicks "login with facebook" then he would be redirected to facebook website and after he logs in I should receive a facebook user ID,
2) search for user id in local database and if it is found then just use stored token
2a) If user is not found then send him back to facebook to grant my application access permissions
2b) receive user token from facebook and store it in local database
Basically, the difficulty for me is to query facebook for current user id without passing a user token to facebook. Thanks for any help
to query facebook for current user id without passing a user token to facebook
No. This isn't possible, facebook will never give you user_id without their knowledge. They have to authorize your application first.