If you do not have a token, then register an (e.g. "Website") application at https://developers.facebook.com/apps and make a note of your "App ID" and "App Secret" at the "Dashboard" of your application. Then go to "Settings", click on "Add Platform", then "Website" and paste http://localhost:1410 as the "Site URL". Save, and then run the below example R commands to get your token. Please note that your app needs access to your ads as well, see https://developers.facebook.com/docs/marketing-api/overview/authorization for more details.
fbad_init(accountid, token, version = fb_api_most_recent_version())
Arguments
accountid: Facebook Ad account id without the act_ prefix
token: Facebook OAuth token as a string
version: Facebook Marketing API version
Returns
list returned invisibly containing versioned base URL and relevant API parameters
Examples
## Not run:## You can generate a token for future use with the help of `httr`, e.g.library(httr)app <- oauth_app("facebook", your_app_id, your_app_secret)oauth2.0_token(oauth_endpoints("facebook"), app, scope ='', type ="application/x-www-form-urlencoded")$credentials$access_token
## Then pass this token with your account ID to fbad_init## End(Not run)