> library(httr)
> app <- oauth_app('facebook', 'my_id', 'my_secret')
> tkn <- oauth2.0_token(
+ oauth_endpoints('facebook'), app, scope = 'business_management',
+ type = 'application/x-www-form-urlencoded', cache = FALSE)
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
> tkn$credentials$access_token
NULL
> tkn$credentials
$`{"access_token":"my_access_token","token_type":"bearer","expires_in":5098355}`
[1] ""
> tkncopy <- "my_token" #manually extracted token from credentials list
> library(devtools)
> install_github("cardcorp/fbRads")
Skipping install of 'fbRads' from a github remote, the SHA1 (fc6cc5a7) has not changed since last install.
Use `force = TRUE` to force installation
> acctid <- "my_ad_account_id"
> fbacc <- fbad_init(accountid = acctid, token = tkncopy)
ERROR [2017-06-01 16:53:45] URL: https://graph.facebook.com/v2.8/act_377523705722721/
ERROR [2017-06-01 16:53:45] Method: GET
ERROR [2017-06-01 16:53:45] Params: List of 1
$ fields: chr "name,account_id,account_status,age,amount_spent,balance,end_advertiser,funding_source,spend_cap,timezone_id,users"
ERROR [2017-06-01 16:53:45] Header: {"WWW-Authenticate":["OAuth \"Facebook Platform\" \"invalid_request\" \"(#3) Application does not have the capability to make this API call.\""],"Access-Control-Allow-Origin":["*"],"Pragma":["no-cache"],"Cache-Control":["no-store"],"x-fb-rev":["3057537"],"Content-Type":["application/json; charset=UTF-8"],"x-fb-trace-id":["CKY+xp03Lm4"],"facebook-api-version":["v2.9"],"Expires":["Sat, 01 Jan 2000 00:00:00 GMT"],"X-FB-Debug":["RDKfEF5KzJzM1RDQUFIlU7+1hF+d2qRx0x7Hvww01BBMkoX4c8iruxRLN/zSvd4rT8QarSK2MvQ+pavDni9+Jw=="],"Date":["Thu, 01 Jun 2017 23:53:45 GMT"],"Connection":["keep-alive"],"Content-Length":["152"],"status":["400"],"statusMessage":["Bad Request"]}
ERROR [2017-06-01 16:53:45] Body: {"error":{"message":"(#3) Application does not have the capability to make this API call.","type":"OAuthException","code":3,"fbtrace_id":"CKY+xp03Lm4"}}
Error in fbad_request(path = paste0("act_", accountid, "/"), method = "GET", :
(#3) Application does not have the capability to make this API call.
Hello!
Thanks to the contributors of this package! Looking forward to getting up and running. Early on I'm experiencing an minor issue with extracting the access code from tkn, but attempted a manual workaround for that (tkncopy). Later on, when trying to initiate via fbad_init, I'm getting a length error (included below). In summary, "(#3) Application does not have the capability to make this API call".
Appreciative of all advice - Thanks!