XTA2
XTA2 copied to clipboard
"cannot find the Facebook user"
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!
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.
Forked and updated here: https://github.com/timmahoney/XTA2
Awesome - thanks!
@timmahoney ,
There is a problem in the code.
- Add $this->config->load('facebook'); in the constructor of the auth controller OR put $autoload['config'] = array('facebook'); in the autoload.php file.
- 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
@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()
Hi @cyberjunkie - I personally haven't run into this, but I'll check it out later tonight and try to replicate it.
@timmahoney thank you! I'll be searching for solutions as well
@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.
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..
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');
I'll check it out, thanks @grey04 !
@grey04 : The problem still remain here! Please check http://tormuz.com/ci_oauth/index.php/auth_other/
has anyone got this script working ?
Any solution or an upgrade for this? Still getting cannot find the Facebook user.
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.