XTA2 icon indicating copy to clipboard operation
XTA2 copied to clipboard

"cannot find the Facebook user"

Open matthewphewes opened this issue 13 years ago • 15 comments

I've got everything setup correctly I think - all of the other services are working... Facebook authorizes and responds with a code but I get the message on my end "cannot find the Facebook user" no matter what I try.

I saw somewhere there were some PHP extensions that needed to be installed - I enabled them and all... Could there be something else I'm doing wrong? Did Facebook change something?

Thanks for any help you can provide!

matthewphewes avatar Dec 28 '11 21:12 matthewphewes

I replaced the Facebook files in the libraries folder with the default Facebook PHP SDK files. Then, I set up a /application/config/facebook.php file and put my application information in here like so:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config["appId"] = "APP ID";
$config["secret"] = "APP SECRET";
$config["fileUpload"] = false; // or true whatever you like.

/* End of file facebook.php */
/* Location: ./application/config/facebook.php */

Config files for libraries that get auto-loaded can load config file information from files named after the library - hence facebook.php.

The issue is that it's not loading the cookie correctly. I'm not sure what version of the Facebook SDK he's got in here, but this worked perfectly.

timmahoney avatar Dec 29 '11 22:12 timmahoney

Forked and updated here: https://github.com/timmahoney/XTA2

timmahoney avatar Dec 29 '11 22:12 timmahoney

Awesome - thanks!

matthewphewes avatar Jan 03 '12 14:01 matthewphewes

@timmahoney ,

There is a problem in the code.

  1. Add $this->config->load('facebook'); in the constructor of the auth controller OR put $autoload['config'] = array('facebook'); in the autoload.php file.
  2. In the file application\views\auth\login_form.php file instead of config->item('appId');?> you have used config->item('facebook_app_id');?> this is causing errors.

Cheers Jaspal Singh

jaspalSingh avatar May 26 '12 08:05 jaspalSingh

@timmahoney thanks for forked update! For some reason it returns the same user when i log into different facebook accounts. Is anyone else having this issue? I'm also getting Call to undefined method Facebook::get_facebook_cookie()

cyberjunkie avatar Jun 07 '12 20:06 cyberjunkie

Hi @cyberjunkie - I personally haven't run into this, but I'll check it out later tonight and try to replicate it.

timmahoney avatar Jun 07 '12 20:06 timmahoney

@timmahoney thank you! I'll be searching for solutions as well

cyberjunkie avatar Jun 07 '12 20:06 cyberjunkie

@timmahoney I looked in the files and saw that welcome.php view where it goes after logging in uses the get_facebook_cookie() function from the non PHP SDK file. And as mentioned, echo $username returns the same user for all facebook logins. Not sure how to fix it. I think the facebook.php controller should be capitalized.

cyberjunkie avatar Jun 07 '12 20:06 cyberjunkie

Has anyone got the plugin to work? I'm logging in with different Facebook accounts and it uses the same Facebook user from the db. I looked at the code, tracing how everything works but can't spot where the error is..

cyberjunkie avatar Jun 19 '12 23:06 cyberjunkie

I think I have found the problem. In controllers/auth_other.php there is $fb_user = $this->facebook->getUser(); $this->session->set_userdata('facebook_id', $fb_user['id']); $user = $this->user_model->get_user_by_sm(array('facebook_id' => $fb_user['id']), 'facebook_id');

But the new getUser doesn't return an array, just the id Changing to this should fix it $this->session->set_userdata('facebook_id', $fb_user); $user = $this->user_model->get_user_by_sm(array('facebook_id' => $fb_user), 'facebook_id');

grey04 avatar Jun 24 '12 12:06 grey04

I'll check it out, thanks @grey04 !

timmahoney avatar Jun 25 '12 19:06 timmahoney

@grey04 : The problem still remain here! Please check http://tormuz.com/ci_oauth/index.php/auth_other/

itskawsar avatar Jan 07 '13 07:01 itskawsar

has anyone got this script working ?

ivailoiliev avatar Jan 30 '13 22:01 ivailoiliev

Any solution or an upgrade for this? Still getting cannot find the Facebook user.

ulac avatar Apr 09 '14 00:04 ulac

To imcl and everyone else having this xta2 and facebook issue, I found the solution on this url: http://blog.codebusters.pl/en/entry/oauth-20-facebook-changes-and-cookie-problem-in-codeigniter.

Basically you have to edit get_facebook_cookie() function inside facebook library, and in the welcome view change $fb_cookie[‘session_key’] to $fb_cookie[‘code’].

Hope it helps.

alokbanjare avatar Sep 12 '14 07:09 alokbanjare