I have created an Facebook App. I need user to be able to post images to my facebook page's album through that App and for that I need to grab Access Token of the page. I can only get access token when I am logged in as an administrator of the page but if I log in with other account I don't get the access token of the page (Even though I liked the page and installed the App). Code is below
$fanpage = 'XXXXXXXXXXXXX';
$pages_arr = array(
'access_token'=>$access_token,
'fields'=>'access_token'
);
$page_token = $facebook->api('/'.$fanpage, 'get', $pages_arr);
$fanpage_token = $page_token['access_token'];
**//When logged in as admin of the page I get the token but I don't get the token if I am not //page admin**
echo $fanpage_token;
$file = "@".realpath("test.jpg");
$args = array(
'message' => 'test',
'image' => $file,
'aid' => $album_id,
'no_story' => 1,
'access_token' => $fanpage_token // note, we use the page token here
);
$photo = $facebook->api("/$album_id/photos", 'post', $args);
if( is_array( $photo ) && ! empty( $photo['id'] ) )
echo 'Photo uploaded. Check it on Graph API Explorer. ID: ' . $photo['id'];
I asking for following permissions on App install
manage_notifications,user_photos,photo_upload,publish_stream,friends_photos,manage_pages