开发者

Facebook infinite redirect loop during authentication

I am getting an infinite loop in the URL redirect after a user either logs in or is already logged in. The page redirects to the login page if the user is not logged in as expected , but goes in the loop as soon as he enters the credentials.

Following is the code:

<?php

include_once ('facebook.php');
  $api_key = 'xxxxxxxxxxxx';
  $secret  = 'xxxxxxxxxxxx';
  global $facebook;
  $facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$uid = $facebook->require_login($required_permissions = 'email,status_update,offline_access');
$f开发者_如何学JAVAacebook->api_client->users_hasAppPermission("offline_access",$uid);
#echo $uid;
 #   $facebook->api_client->users_setStatus("hello",$uid);
  #   echo "<p>Your status has been updated</p>";
 ?>

Interestingly this code was working before, but suddenly started giving me an infinite loop problem. There have been couple of discussion on facebook forum about this but no indication that is a bug or what is the workaround .

Any help would be highly appreciateed.

Thanks


I added the code to direct to login only if the user is not logged in else do not do that. This worked for me! .. Hope it helps.

$is_tab = isset($_POST['fb_sig_in_profile_tab']);
if( !$is_tab ){
    $uid = $facebook->require_login($required_permissions = 'email,status_update                                              ,offline_access');
}
else{
    $uid = $facebook->get_profile_user();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜