Question

I keep getting this error when I try to use my app I created for Facebook. When I go the the url for the app it take me to the login page, but when I log in I get a pop up box with the error.

App Not Setup: The developers of this app have not set up this app properly for Facebook Login.

Every time I click ok it just reloads the popup again.

I have already changes the satatus to Live under status and review in my dashboard.

When I log into my account on facebook, it works fine, but I suppose this is because I am set as an admin for the app on the dashboard.

But other users get the problem above.

The code used:

require_once('facebook-php-sdk/src/facebook.php');

        $facebook= new Facebook(array(
          'appId' => $this->config->item('app_id'),
              'secret' => $this->config->item('app_secret'),
              'allowSignedRequest' => true,
        ));

        $_REQUEST += $_GET;
        $user = $facebook->getUser();

        if ($user) {
          try {

            $user_profile = $facebook->api('/me?fields=picture.width(100).height(100),first_name,last_name,username,email');

          } catch (FacebookApiException $e) {
            $user = null;
          }
        } else {
           $login_url = $facebook->getLoginUrl(array(
                'scope' => 'email'
            ));

           redirect($login_url, 'refresh');
        }

This code is in my controller of my codeigniter application which I built the app.

How do I fix this?

UPDATE:

After I added the app as a canvas app this error seemed to go away, however there is still a problem.

I added the Facebook app platform and entered the canvas url, secure canvas url etc.

When I go to the app at the canvas page https://apps.facebook.com/MyApp/ - it work fine as I am a app administrator I guess.

However when an external user goes to the canvas page it just remain blank, but if a user goes to the canvas url http://apps.mydomain.com/MyAPP the app asks for their permissions and works fine as a website.

It just remains blank to users on the canvas page. Why doesn't the canvas page ask for permission?

Help Please.

EDIT:

require_once('facebook-php-sdk/src/facebook.php');

        $facebook= new Facebook(array(
          'appId' => $this->config->item('app_id'),
              'secret' => $this->config->item('app_secret'),
              'allowSignedRequest' => true,
        ));

        $_REQUEST += $_GET;
        $user = $facebook->getUser();

        if ($user) {
          try {

            $user_profile = $facebook->api('/me?fields=picture.width(100).height(100),first_name,last_name,username,email');

          } catch (FacebookApiException $e) {
            $user = null;
          }
        } else {
           $login_url = $facebook->getLoginUrl(array(
                'scope' => 'email'
            ));

           require_once('facebook-php-sdk/src/facebook.php');

    $facebook= new Facebook(array(
      'appId' => $this->config->item('app_id'),
          'secret' => $this->config->item('app_secret'),
          'allowSignedRequest' => true,
    ));

    $_REQUEST += $_GET;
    $user = $facebook->getUser();

    if ($user) {
      try {

        $user_profile = $facebook->api('/me?fields=picture.width(100).height(100),first_name,last_name,username,email');

      } catch (FacebookApiException $e) {
        $user = null;
      }
    } else {
       $login_url = $facebook->getLoginUrl(array(
            'scope' => 'email'
        ));

        echo("<script> top.location.href='" . $login_url . "'</script>");
        }
Was it helpful?

Solution

Why doesn't the canvas page ask for permission?

Because you are redirecting inside of the iframe, but the FB login dialog does not want to be displayed in (i(frames) – for the obvious reason, that that would lead to a lot of phishing, since users are supposed to see that the page they are entering their login credentials too is actually the real FB site.

So you have to redirect within the top window instance, via JavaScript:

top.location.href = '…';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top