Eric Holmes
Eric Holmes

Reputation: 415

Facebook JS SDK - Photo uploads but does not appear on timeline

I am uploading photos through my app, and the photos are being successfully uploaded to the logged-in user's Photos section. However, some users are not getting their photo to be posted on their timeline. Is there an account setting that is causing this? Is there another object variable I can pass to ensure it gets "shared" when it's uploaded?

EDIT: It appears that the images went into "Pending approval" status - is there a way to bypass this?

Thanks in advance.

var file_name = 'http://their-image.com/image.jpg';
var access_token = FB.getAuthResponse()['accessToken'];
FB.api('/me/photos', 'post',{
    message: "The image message.",
    url: file_name
    },
    function(response){
        if (!response || response.error) {
            alert('Error occurred');
        } else {
            alert('Your photo was posted!');
        }
    }
);

Upvotes: 2

Views: 1473

Answers (1)

Eric Holmes
Eric Holmes

Reputation: 415

I have found the issue. Some user settings require that you must Approve any photos uploaded by a Facebook App. So the photo is being added, but it is sitting in "pending" under the user's Album for the app.

Here is a code-bit that will help you get the link to your app's album, so the user can view their photos that are awaiting approval.

FB.api('/me/albums', function(response) {
    // console.log(albums);
    var albums = response['data'];
    for (var key in albums) {
        var album = albums[key];
        if (album['name'] == 'You App Name's Photos') {
            alert(album['link'];
        }
    }
});

Upvotes: 2

Related Questions