← Back to Social Login Support
I have installed social plugin,becouse I would like to have possibility for a sign in with Facebook account on my page.
As instruction in plugin says that:
1.Go to https://developers.facebook.com/ and click Create a New App in the Apps drop down.
2.Enter your Display Name (usually your site name) along with any other required fields and click Create App
3.Copy your App ID and App Secret into the fields below.
4.On the Settings tab set the Valid OAuth redirect URIs to http://www.example.com/flynsarmy/sociallogin/Facebook
So I have done each steps.
But I got stuck.
I got this when I'm trying to log into website with facebook account in my log files(directly in back-end/settings/logs/event log :
Authentication failed! Facebook returned an invalid user id. in public_html/plugins/flynsarmy/sociallogin/vendor/hybridauth/hybridauth/hybridauth/Hybrid/Auth.php on line 169
and also when I tried to log into website with facebook account, I have redirected on my login page with #= (it could be hint to solve a problem) in the end of url.
For example if my login page is:
www.example.com/login
redirected page is:
www.example.com/login#=
I've read:
http://stackoverflow.com/questions/20777100/hybridauth-facebook-returned-an-invalid-user-id
http://stackoverflow.com/questions/14068425/hybridauth-php-facebook-returned-an-invalid-user-id
http://stackoverflow.com/questions/20777100/hybridauth-facebook-returned-an-invalid-user-id
And nothing has helped me, Thank You for any help info.
This is NOT the right way to do this, but if you need a quick fix:
Edit composer.json in package
// -- file: /plugins/flynsarmy/sociallogin/composer.json
// -- CHANGE
"hybridauth/hybridauth": "^2.9.3-dev",
Run in terminal
composer update
Modify package file:
// -- file: /plugins/flynsarmy/sociallogin/socialloginproviders/Facebook.php
// -- line: 89
// -- ADD:
$email = '';
if (isset($userProfile->email)){
$email = $userProfile->email;
}
if (isset($userProfile->username)){
$username = $userProfile->username;
} else {
$username = $email;
}
// -- REPLACE return array with:
return [
'token' => $userProfile->identifier,
'email' => $userProfile->email,
'username' => $username,
'name' => $userProfile->firstName.' '.$userProfile->lastName,
];
Thank You Conan,
Becouse I don't have ssh access to my server, I installed 2.9.3-dev ver manually. I did each steps just without command:
composer update
And I have got next problem:
Class 'Facebook\Facebook' not found
/home/infgame/domains/inf.webion.pl/public_html/plugins/flynsarmy/sociallogin/vendor/hybridauth/hybridauth/hybridauth/Hybrid/Providers/Facebook.php line 71
What did I in wrong way?
The hybrid auth composer package mentioned something about this I recall. It was strongly suggested you use composer to install the package because it provides a class map by doing so.
The best method would be to just do it on your dev environment, confirm it works and then upload the plugin and vendor folder.
conan said:
This is NOT the right way to do this, but if you need a quick fix:
Edit composer.json in package
// -- file: /plugins/flynsarmy/sociallogin/composer.json // -- CHANGE "hybridauth/hybridauth": "^2.9.3-dev",
Run in terminal
composer update
Modify package file:
// -- file: /plugins/flynsarmy/sociallogin/socialloginproviders/Facebook.php // -- line: 89 // -- ADD: $email = ''; if (isset($userProfile->email)){ $email = $userProfile->email; } if (isset($userProfile->username)){ $username = $userProfile->username; } else { $username = $email; } // -- REPLACE return array with: return [ 'token' => $userProfile->identifier, 'email' => $userProfile->email, 'username' => $username, 'name' => $userProfile->firstName.' '.$userProfile->lastName, ];
Thank You very Much! :D
1-6 of 6