Note that there are some explanatory texts on larger screens.

plurals
  1. POposting image with fb api getting error for new users
    text
    copied!<p>Fatal error: Uncaught OAuthException: An unexpected error has occurred. Please retry your request later.</p> <p>I am trying give an option to Change their facebook cover from my website using facebook api. Here is my code:</p> <pre><code>&lt;script&gt; FB.login(function(response) { if (response.authResponse) { if (response) { fblogin(); // user is logged in and granted some permissions. } else { // user is logged in, but did not grant any permissions alert('Kindly allow the My App to access the Facebook Account'); } } else { // user is not logged in alert('You are not logged in Facebook Account'); } }, {scope:'read_stream,publish_stream,publish_actions,offline_access,email'}); function fblogin() { var imageName = 'myimage.png'; jQuery.post("/facebook/index", {imageName:imageName}, function(data){ if(data) { parent.window.open("http://www.facebook.com/profile.php?preview_cover="+data,'_blank'); } else { alert('Please Login.'); } }); } &lt;/script&gt; </code></pre> <p>After login when i posted image name then :</p> <pre><code>require_once('/api/facebook/src/facebook.php'); $this-&gt;objfacebook = new Facebook(array( 'appId' =&gt; FB_APP_ID, 'secret' =&gt; FB_SECRET_KEY, 'fileUpload' =&gt; true, 'cookie' =&gt; true )); $user_id = $this-&gt;objfacebook-&gt;getUser(); $access_token = $this-&gt;objfacebook-&gt;getAccessToken(); if ($user_id) { $this-&gt;objfacebook-&gt;setFileUploadSupport(true); //Create an album $album_details = array( 'message'=&gt; 'Cover Photo', 'name'=&gt; 'Created on My App' ); $create_album = $this-&gt;objfacebook-&gt;api('/me/albums', 'post', $album_details); $album_uid = $create_album['id']; //Uploading Photo $photo_details = array( 'message'=&gt; 'Cover Photo', 'name'=&gt; 'Created on My App' ); $file = BASE_PATH."/public/images/".$_POST['imageName']; //BASE_PATH - Actual path of image $photo_details['image'] = '@' . realpath($file); $upload_photo = $this-&gt;objfacebook-&gt;api('/'.$album_uid.'/photos', 'post', $photo_details); echo $upload_photo['id']; exit(); } </code></pre> <p>For my old user it is working fine, they have no issue when they changed their Facebook cover. <br/> But when users come with their new facebook account to change their facebook they get a fetal error everytime.</p> <p>I also have tried this with my new facebook account, it also gives me same Fetal Error.</p> <p>I have no idea why is this happening for new users? Am i doing anything wrong here?</p> <p>please give some idea.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload