简体   繁体   中英

How to create album and post image to it,facebook javascript sdk

How to create an app which create an album and post an image from url to it when user click a button and how to set publish_stream permission

The below code is not working

FB.api('/PAGE_ID/photos', 'post', {
  url: 'http://example.com/image.png',
  message: 'Upload demo'
}, function(response){
  if (response && response.id)
    console.log('Photo uploaded', response.id);
});

Your first part is quite unclear. For publish_stream , you may use javascript API as-

FB.login(function(response) 
        {
           if (response.authResponse) 
           {
                          // success
           } 
           else 
           {
                         // fail

           }
         },{scope: 'publish_stream,email'}
      );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM