puneetkay/Facebook-PHP-CodeIgniter

Login seems not work at first time

tthanhlong opened this issue · 4 comments

At first time click on "Login" button, page is refresh and show "Login" button again (the same happenes on the Demo). So we have to click "Login" one more time for logging in. From the second times, it works properly.
How to fix this, please help!

Thanks and regards!

axu34 commented

I have the same problem.
I think we have this problem because the SDK is outdated v.3.2.3 and the current one is 4.0.23.
@tthanhlong did you fix your problem?
@puneetkay can you please help us?

Hi @axu34 :

Fixed the problem by removing

$this->facebook->destroySession();

from

if ($user) {
            try {
                $data['user_profile'] = $this->facebook->api('/me');
            } catch (FacebookApiException $e) {
                $user = null;
            }
        }else {
            $this->facebook->destroySession();
        }

Regards!

axu34 commented

@tthanhlong Works! Thank you!

@tthanhlong @axu34 Cheers guys! Updated the repo.