认证过程中的Facebook无限重定向循环 [英] Facebook infinite redirect loop during authentication

查看:339
本文介绍了认证过程中的Facebook无限重定向循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用户登录或已经登录之后,我在URL重定向中获得无限循环。如果用户未按预期登录,则页面将重定向到登录页面,但一旦进入循环他输入凭证。



以下是代码:

 <?php 

include_once('facebook.php');
$ api_key ='xxxxxxxxxxxx';
$ secret ='xxxxxxxxxxxx';
全球$ facebook;
$ facebook = new Facebook($ api_key,$ secret);
$ facebook-> require_frame();
$ uid = $ facebook-> require_login($ required_permissions ='email,status_update,offline_access');
$ facebook-> api_client-> users_hasAppPermission(offline_access,$ uid);
#echo $ uid;
#$ facebook-> api_client-> users_setStatus(hello,$ uid);
#echo< p>您的状态已更新< / p>;
?>有趣的是,这段代码是有效的,但是突然开始给我一个无限循环的问题。在Facebook论坛上已经有过几次讨论,但没有迹象表明这是一个错误或什么是解决方法。



任何帮助都将非常感激。



谢谢

解决方案

我添加了代码直接登录如果用户没有登录,请不要这样做。这对我有用希望有帮助。

  $ 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();
}


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');
$facebook->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();
}

这篇关于认证过程中的Facebook无限重定向循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆