简体   繁体   English

CodeIgniter和Facebook登录重定向网址

[英]CodeIgniter and Facebook login redirect url

I'm using PHP SDK for Facebook in CI and all works well except in the facebook login. 我正在CI中使用适用于Facebook的PHP SDK,除了在Facebook登录中之外,其他所有功能都正常运行。 I set the redirect_url to 'http://mysite.com/index.php' so that facebook will redirect back to the home page after login. 我将redirect_url设置为“ http://mysite.com/index.php”,以便Facebook在登录后将重定向回首页。 The problem is that when redirecting, facebook adds a query string like so: http://mysite.com/index.php?status=xxxx&code=xxxx and since my $config['enable_query_strings'] is set to false, it doesn't work. 问题在于,重定向时,facebook添加如下查询字符串: http ://mysite.com/index.php?status=xxxx&code=xxxx,并且由于我的$ config ['enable_query_strings']设置为false,所以它不会工作。 How can I get around this? 我该如何解决? I do not want to enable the query strings in CI. 我不想在CI中启用查询字符串。

Please help. 请帮忙。

You could try this : my config.php file is 您可以尝试:我的config.php文件是

$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;

this is my controller and its work for me : 这是我的控制器及其对我的工作:

$myurl = "http://mysite.com/index.php";

redirect($this->facebook->getLoginUrl(array('scope' => 'email', 'redirect_uri' => $myurl)));

Thanks for the replies guys. 谢谢你们的答复。 Apparently, it's a jQuery mobile bug, not CI. 显然,这是一个jQuery移动错误,而不是CI。 Found the answer here: Facebook Oauth Login With Jquery Mobile #_=_ 在这里找到答案: Facebook Oauth使用Jquery Mobile登录#_ = _

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM