title: Facebook - You don't have required permission to access this profile
body: <p>I'm trying to build a service that let's users create facebook ads with a custom audience based on our database of emails. </p>
  
  <p>Before creating the facebook ad I want to create a preview of the ad. This works just fine when I login in with my own account (admin of facebook app) but fails when logging in as test user.</p>
  
  <p>This is what the user will do:
  1. Visit the website of the service.
  2. Login using Facebook account with scope: public_profile,email,manage_pages,publish_pages,business_management,ads_management
  3. Select facebook page to use 
  4. Create AdCreative. From this an ad preview can be made. But it fails creating an Adcreative and gives me the following error:</p>
  
  <pre><code>"error":{"message":"Application does not have permission for this action","type":"OAuthException","code":10,"error_subcode":1341012,"is_transient":false,"error_user_title":"No permission to access this profile","error_user_msg":"You don't have required permission to access this profile","fbtrace_id":"EgTeMOXPCUp"}}
  </code></pre>
  
  <p>The access token as well as ad account belongs to the facebook app. I tried to use the page access token as well but then I don't have permission to access the ad account.
  This is code:</p>
  
  <pre><code>function fbadcreative($url, $message, $carasoul, $fbtoken, $pageid){
  
  $calength = count($carasoul);
  $children = array();
  for($i = 0; $i &lt; $calength; $i++){
      $caitem = $carasoul[$i];
      $caitem['hash'] = fbaddimage($caitem['picture'], $caitem['id']);
      $child = (new AdCreativeLinkDataChildAttachment())-&gt;setData(array(
          AdCreativeLinkDataChildAttachmentFields::LINK =&gt; $caitem['link'],
          AdCreativeLinkDataChildAttachmentFields::NAME =&gt; $caitem['name'],
          AdCreativeLinkDataChildAttachmentFields::DESCRIPTION =&gt; $caitem['description'],
          AdCreativeLinkDataChildAttachmentFields::IMAGE_HASH =&gt; $caitem['hash'],
      ));
      $children[] = $child;
  }
  $link_data = new AdCreativeLinkData();
  $link_data-&gt;setData(array(
    AdCreativeLinkDataFields::LINK =&gt; $url,
    AdCreativeLinkDataFields::CAPTION =&gt; $url,
    AdCreativeLinkDataFields::MESSAGE =&gt; $message,
    AdCreativeLinkDataFields::MULTI_SHARE_END_CARD =&gt; false,
    AdCreativeLinkDataFields::MULTI_SHARE_OPTIMIZED =&gt; false,
    AdCreativeLinkDataFields::CHILD_ATTACHMENTS =&gt; $children,
  ));
  $object_story_spec = new AdCreativeObjectStorySpec();
  $object_story_spec-&gt;setData(array(
    AdCreativeObjectStorySpecFields::PAGE_ID =&gt; $pageid,
    AdCreativeObjectStorySpecFields::LINK_DATA =&gt; $link_data,
  ));
  
  $creative = new AdCreative(null, 'act_&lt;accountid&gt;');
  $creative-&gt;setData(array(
    AdCreativeFields::NAME =&gt; $url,
    AdCreativeFields::OBJECT_STORY_SPEC =&gt; $object_story_spec,
  ));
  try {
      $creative-&gt;create();
       return $creative-&gt;id;
      //return $creative-&gt;read(array(AdCreativeFields::ID,));
  } catch (FacebookAds\Http\Exception\AuthorizationException $e) {
      echo 'Message: ' . var_dump($e);
      $previousException = $e-&gt;getPrevious();
      // Do some further processing on $previousException
      exit;
  }
  </code></pre>