Codeigniter getuser() returns 0 after facebook dialog

℡╲_俬逩灬. 提交于 2019-12-25 03:27:28

问题


You could say that this post is dublicate but I'm searching for nearly 2 days , couldn't figured out.

After moved to new server and installed new ssl, I'm having difficulties for facebook login in two different scenarios.

First Scenario:

User haven't logged in to facebook and facebook login redirects user to , facebook login. After user login, facebook redirects to redirect_url and getuser returns 0.

(User could login if return back to facebook login page on my website so getuser works when user already logged in to facebook).

Second Scenario:

User signs up, goes to permissions dialogue and when user gives permissions, again getuser returns 0 , so I was thinking to skip first scenario but this scenario is viral.

I have tried this solutions :

We are using nginx now, in previous server I did this updates and today I will tell you which conf we already added.

1- Base_facebook.php code needs to be updated for codeigniter and new php versions.

Facebook PHP SDK: Fixing getUser() on PHP 5.4.x

2- Nginx cookie sized changed, at the beginning even normal facebook login doesn't work.

3- I read something about nginx custom headers , we did these updates nginx-php-fpm-and-custom-header

Nginx underscore headers

4- CURLOPT_SSL_VERIFYPEER => false added to base_facebook, again another solution for other users.

I think after all these updates we missed a little something but I really can't see what is wrong? So I will be really happy if you could share your experience with me we could figure out what is wrong.

5- parse_str($_SERVER['QUERY_STRING'],$_REQUEST); added before libraries included.

My example fb_login controller. I'm tank_auth_social with tank_auth

 function fblogin()
{

    parse_str($_SERVER['QUERY_STRING'],$_REQUEST);
    $this->load->helper(array('form', 'url'));
    $this->load->library('form_validation');
    $this->load->library('security');
    $this->load->library('tank_auth');
    $this->load->library('tank_auth_social');
    $this->lang->load('tank_auth');
    $fb_id = $this->facebook->getUser();

    //inline_debug($fb_id);
    // To see if we have facebook id




    // User is found
    if( isset($fb_id) )
    {
        $user_profile = $this->facebook->api('/'.$fb_id);

    }

My Conf:

PHP Version 5.5.9-1ubuntu4 Nginx, FPM PHP My server is on digitalocean.

Thanks alot.

来源:https://stackoverflow.com/questions/24314405/codeigniter-getuser-returns-0-after-facebook-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!