There are two different ways of making authenticated requests. One is to obtain
a temporary access token from https://developers.facebook.com/tools/explorer/,
which can be used as argument in any of the functions in Rfacebook. An example is
shown below.
However, this token has a 2-hour lifetime by default and after it expires, it
needs to be renewed. The second alternative is to create an OAuth token. The
process to create it is a bit more tedious. It is divided in three steps.
First, go to https://developers.facebook.com/apps, register as a developer
and create a new app. You will also need a verified Facebook account.
After that, click in "Show" under "App Secret" to find your 'App ID' and 'App Secret'.
Second, run the fbOAuth
function with your "App ID" and "App Secret" as
arguments.
Third, after pressing Enter, R will try to open a browser window to sign the token. If
everything works well, you will get a message that says you can return to R. If not,
try again in a few minutes to make sure your application had its settings updated properly.
If you set cache=TRUE
, a file .httr-oauth
is then saved in your home directory.
This file caches the OAuth credentials so you don't need to perform the browser authentication a second time
if you don't change the App ID, the App Secret or the permissions you grant.