Facebook Authentication login throws error

Permalink
Hi All
I've enabled Facebook & Twitter authentication login along with standard C5 login. But while using FB btn, it throws the below error in log:
An exception occurred while executing 'insert into Users (uName, uEmail, uPassword, uIsValidated, uDateAdded, uLastPasswordChange, uIsFullRecord, uDefaultLanguage, uIsActive) values (?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["", null, "$2a$12$LyBahyn5ln250X1TK9XwVOhS4cJYHKiumtX2aixZ9JO\/RTw8x3kBm", 1, "2016-06-24 07:08:11", "2016-06-24 07:08:11", 1, null, 1]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uEmail' cannot be null

Not sure why it cannot fetch email and passed as NULL value?

Thanks
Rony

ronyDdeveloper
 
FumitoMIZUNO replied on at Permalink Reply
FumitoMIZUNO
Hello, Rony.

I had a same problem.

Facebook document says;
https://developers.facebook.com/docs/facebook-login/permissions#refe...
`Note, even if you request the email permission it is not guaranteed you will get an email address. For example, if someone signed up for Facebook with a phone number instead of an email address, the email field may be empty.`


Maybe we need to update Facebook Authentication program to allow a user to fill in his/her email. Twitter Authentication process asks a user to fill in his/her email.
savan replied on at Permalink Reply
Hello everyone,

Finally, i found fb login issue solution sharing here.

I was using facebook 5.8 and still found fb login issue. I found one issue which is related to token read of facebook and other issue the url as posted by @micrdy .

Below is 2 changes which i did after that fb login started working for me

1. concrete5-8.1.0\concrete\vendor\lusitanian\oauth\src\OAuth\OAuth2\Service\Facebook.php

IN FUNCTION parseAccessTokenResponse($responseBody)

replace
parse_str($responseBody, $data);

With
$data=json_decode($responseBody,true);

2. concrete5-8.1.0\concrete\vendor\oryzone\oauth-user-data\src\OAuth\UserData\Extractor\Facebook.php

Instead of
const REQUEST_PROFILE = '/me';

go with:
const REQUEST_PROFILE = '/me?fields=name,email';