Search code examples
facebookcodeigniterfacebook-appsfacebook-authentication

Facebook App redirect to domain


I am creating Facebook application using PHP, in authentication process, facebook redirect to my domain,

This is simple code to get authentication::

 $params = array(
 'scope' => 'email,user_about_me, user_birthday, user_location');
  $url = $this->facebook->getLoginUrl($params);
 echo "<script type='text/javascript'>" . "top.location.href = '" . $url. "';</script>";

if i write a 'redirect_url' = 'https://apps.facebook.com/appname' then app is go in infinite loop.

i am confused to find out the solution. I am develop this application in PHP codeIgniter Framwork.please help me, thanks advance.


Solution

  • Did you try this?

    $params = array(
     'scope' => 'email,user_about_me, user_birthday, user_location',
     'redirect_uri' => 'http://apps.facebook.com/yourappsnamespace'
    );
      $url = $this->facebook->getLoginUrl($params);
     echo "<script type='text/javascript'>" . "top.location.href = '" . $url. "';</script>";