0

I have a situation like,

To read all my FB albums and its full contents to display it on the web page.But the issue is I don't want to login for this.

Like my Fb albums display on my webpages.

I found the same question here but the solution was not getting.

What i did is Created an app.

require 'facebook/facebook.php';
    $facebook = new Facebook(array(
     'appId'  => FB_APP_ID,
     'secret' => FB_APP_SECRET,
    ));

$access_token = "ccc"; this is from graph explorer 1 hr valid key when i logged in then only get this
echo $url = "https://graph.facebook.com/oauth/access_token?          
    client_id=".FB_APP_ID."&
    client_secret=".FB_APP_SECRET."&
    grant_type=fb_exchange_token&
    fb_exchange_token=".$access_token;
    //echo "sss".$return = file_get_contents($url);
    try {
        $result = $facebook->api('/MyFBACCId/albums',array('access_token' => $access_token));
         echo "<pre/>";
         print_r($result);
    } catch(FacebookApiException $e) {
        $result = $e->getResult();
         //error_log(json_encode($result));
         echo "Error Condition";
         echo "<pre/>";
         print_r(($result));


    }

I am also tried to extent the key expire but it was not working like it returns The access token does not belong to application APP_ID

So my question is Is that Possible to get the album details without login .

I found some example like here , In my account also i given the album with public scope. but when i try with graph explorer it return empty result.

the whole day i stuck with this any help will be appreciate :(

Community
  • 1
  • 1
Jobin
  • 8,238
  • 1
  • 33
  • 52

1 Answers1

1

To read an Album you need

  • Any valid access token if it is public and belongs to a Page
  • The user_photos permission if it belongs to a User
  • The friends_photos permission if it belongs to a User's friend

Source: https://developers.facebook.com/docs/reference/api/album/

Your example applies to a page. This is why you can get the album information without any token.

As the documentation explains, you will need permissions to access the albums of a user. With permission, comes a token, which implies a user to login. So, you can't read all facebook album from your FB account without login.

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130