pengkong / A3M-for-CodeIgniter-2.0

A3M Peanutbutter - For CodeIgniter 2.0
Other
109 stars 84 forks source link

Facebook connect #19

Closed simplemuri closed 11 years ago

simplemuri commented 11 years ago

Hi there!

Nice package you made! thanks for sharing.

I followed the instructions and everything ok except for the facebook connect.

The code in facebook_helper was duplicated, but I modified that and now when I click on the facebook button it takes me to a page where theres only a "Login" button (seems to be ok until now)

The thing is, when I click on it, a pop-up window opens and closes inmediately and then nothing happens.

Any clues?

Thanks in advance

donjakobo commented 11 years ago

1 - Duplicate code issue is resolved (download latest code) 2 - popup is the facebook process (was not optimized, you are welcome to).

To clarify (2) the facebook process is handled via JS as we would get an infinite redirect loop otherwise with a non JS solution, so I utilized this mix of PHP + JS and it works, you might have something like mismatching urls for your site (you can't just login to facebook without defining details for your app in config, or having a matching url as per your application setup on fb).

Check those and let me know, it works for me one 2 sites just fine.

simplemuri commented 11 years ago

Thanks for your response jakub!

I'm not being able to fix it. The configuration on my facebook application is correct, though I'm running a piece of javascript (from facebook js sdk) embeded in html that's currently running well.

If you have any other clue I would appreciate.

Is there anything I sould have changed in the code besides the api_key and secret?

arieagung commented 11 years ago

@simplemuri

Try to replace fb_ca_chain_bundle.crt in modules/account/helper with the one from https://github.com/facebook/facebook-php-sdk/tree/master/src

viperfx commented 11 years ago

I have the exact same issue. The popup opens up and it immediately closes, on page refresh though you can reach the next step. However even after signup up through FB, when you logout and log back in, it still asks you to sign in through the facebook button.

EDIT --

I have fixed the login issue by including the JS code from the controller at the bottom of my Signin page.

agusesetiyono commented 11 years ago

@viperfx

where is your update to fixed login issue? i want it to fix my login too. thx

niconphantom commented 11 years ago

Hi guys,

First of all thanks for so nice job! It looks like I have the same issue, let me describe how it fails in my case.

  1. I am logged in to the Facebook
  2. I am clicking on the FB button in A3M to have my FB account linked
  3. It displays login button despite I am logged in. If I will press F5, my FB account will be linked straight away with no clicking on the login button. Wierd isn't it?
  4. If I click on the Fb login button when I see it, I have exactly the same story like other guys, the popup appears for few seconds and nothing happens. I was checking Apache logs after that and here is the error message

"OAuthException: An active access token must be used to query information about the current user"

It looks like the error message is triggered in Facebool_lib.php here:

if ($this->fb->getUser()) {
    try {
        // Check for expired session by making a api call
        $this->user = $this->fb->api('/me');
    } 
    catch (FacebookApiException $e) {
    error_log($e);
    }
}

I am not yet sure how to fix the problem, but if you have any progress on it, please share your ideas.

niconphantom commented 11 years ago

It looks like the issue is coming from FB PHP SDK and is fixed in v.3.2.2 - https://github.com/facebook/facebook-php-sdk/commit/ca9472b3312dab3fdcfbffb4e45eb091f582dcb7

sangwook commented 11 years ago

@niconphantom

I have the same issue.

donjakobo commented 11 years ago

I've updated the FB SDK to v.3.2.2, please give it a go here in the new BootStrapped version :+1:

sangwook commented 11 years ago

@donjakobo

where is class Facebook ?

Fatal error: Class 'Facebook' not found in ...\application\modules\account\libraries\Facebook_lib.php on line 27

facebook_helper.php line#118

abstract class BaseFacebook
donjakobo commented 11 years ago

@sangwook are you referring to @pengkong 's code here? or My bootstrapped fork? As I don't use /app../modules/ anymore... so it could be a reference typo there (haven't tested FB yet after upgrade)

agusesetiyono commented 11 years ago

have same trouble like @sangwook

donjakobo commented 11 years ago

I've updated the code. Due to a large change in FB SDK v3.2.2 it wasn't structured the same, I found another way to do it, someone test please.

Also, open a new issue under my fork, not here, as it is out of scope for this codebase. Thanks.