Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
440 views
in Technique[技术] by (71.8m points)

php - Can't get Video details through Facebook Marketing API despite of having all necessary permissions

I try to get video details from my Creative through Facebook Marketing API.

Here is my code:

 Api::init(
     env('ADS_APP_ID'),
     env('ADS_APP_SECRET'),
     env('ADS_ACCESS_TOKEN')
 );

 $account = new AdAccount(env('ADS_ACCOUNT_ID'));
 $adcreatives = $account->getAdCreatives(array(
     AdCreativeFields::VIDEO_ID,
 ));

 $video_id = $adcreatives[0]->{AdCreativeFields::VIDEO_ID};

 $ad_video = new AdVideo($video_id);
 dd($ad_video->getSelf([AdVideoFields::THUMBNAILS]));

Also I have added necessary permissions in my App and double checked everything, I have:

  • pages_read_engagement - Standart Access
  • Page Public Content Access - Standart Access

Every seems fine and it should work, but I am getting this error:

FacebookAdsHttpExceptionAuthorizationException (#10) This endpoint requires the 'pages_read_engagement' permission or the 'Page Public Content Access' feature. Refer to https://developers.facebook.com/docs/apps/review/login-permissions#manage-pages and https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS for details.

question from:https://stackoverflow.com/questions/65950553/cant-get-video-details-through-facebook-marketing-api-despite-of-having-all-nec

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After conversation with @CBroe in comments section, I can summarise steps which I did to avoid that error message:

  1. Navigate to Graph API Explorer
  2. Select your app in Facebook App select box
  3. Select User token in User or Page select box
  4. Add necessary permissions (in my case it was pages_read_engagement)
  5. Press Generate Access Token button
  6. Copy Token

Additionally if you want token, which will not expire in couple of hours, you can generate it here Long-Lived User Access Token


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...