How to analyze your Facebook friends network with R

Problem Description:

I want to connect via Facebook API in order to get my friends information so that I can analyse my friends' graph. For this reason, I proceed to the following steps:

  1. I have created a new Facebook APP from here: https://developers.facebook.com and set it up by default.

  2. I used this R code in RStudio to connect to my API:

install.packages("devtools")
library(devtools)

# I used install_github to get the updated version of Rfacebook package
install_github("pablobarbera/Rfacebook", subdir="Rfacebook")
require (Rfacebook)
  1. I used this fb_oauth to connect my R session with my app I already created and authenticate it to my Facebook Profile for Data Mining.
require("Rfacebook")
fb_oauth <- fbOAuth(app_id="123456789", app_secret="A2A3A4A", extended_permissions = TRUE)

Results:

I got the following error while trying to connect to Facebook:

When I back to RStudio I found this error:

Copy and paste into Site URL on Facebook App Settings: http://localhost:1410/ 
When done, press any key to continue...
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Error in oauth2.0_access_token(endpoint, app, code = code, user_params = user_params,  : 
  Bad Request (HTTP 400). Failed to get an access token.

NB:
I know that Facebook has updated his API from v2.1 to v3.2 in May 2018. It was possible to get all friends informations through the API v2.1 (people already worked with thiw version it worked very well) but now with this new update, there is no more access to friends informations but only those who are using it.

How I can solve this problem, please?

Thanks in advance.

1 Like

Unfortunatly Rfacebook is no longer being maintained by it's author and there is also the problem of the App Review for getting access to the API, as far as I know there is no easy solution for this, besides trying to comply with facebook requisites.

Hi,
I had the same problem, i created a new app for another page and it worked, the connection was done and i got access to my own page. Try also to remove the parameter "extended_permissions".
My problem is that i can't get public posts from a page i don't administrate. Anyone can help ?

Thanks for your answer. I advice you to read this post.

Thank you for your answer too.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.