Lost Sould
Lost Sould

Reputation: 127

Facebook App Issue - Can not obtain Permissions , Keeps on refreshing

I found this Love Calculator app online , It is open source and free to use, I setted it up on my test server, I added all the app Id's and secrets and did all the setting but I am getting this permissions issue when I or Someone else try to use it , There are 3 Important files in this script,

  1. Config.php (i setted it up , it has only 4 fields for the app id,secret,canvas url,app domain)
  2. Index.php
  3. Facebook.php (this is the sdk I figure)

Config.php is loaded in Index.php with the following code

include_once ('lib/facebook.php'); // Facebook client library
include_once ('config.php'); // Config file

// Constants are located in config.php file
$facebook = new Facebook(
    array(
        'appId'  => FACEBOOK_APP_ID,
        'secret' => FACEBOOK_SECRET_KEY,
        'cookie' => true,
        'domain' => FACEBOOK_DOMAIN
    )
);

Now , When I tried to figure out the problem , I found this code in index.php for obtaining permissions

$session = $facebook->getSession();

if (!$session) {
    $url = $facebook->getLoginUrl(array(
               'canvas' => 1,
               'fbconnect' => 0,
               'scope' => 'publish_stream'
           ));
    echo "<script type='text/javascript'>top.location.href = '$url';</script>";
} else {
    try {
        $uid = $facebook->getUser();
        $me = $facebook->api('/me');
        $updated = date("l, F j, Y", strtotime($me['updated_time']));
    } catch (FacebookApiException $e) {
        echo "<script type='text/javascript'>top.location.href = '$url';</script>";
    exit;
    } 
}

The canvas app url is https://apps.facebook.com/fb-love-calculator-f The domain url is https://apps.mjobz.com/love/

Upvotes: 1

Views: 56

Answers (1)

user4713081
user4713081

Reputation:

You are using and out dated version of facebook sdk, Facebook sdk has updated a couple of times after this one

Upvotes: 1

Related Questions