i'm new to Laravel and i'm trying to make a social auth. I have seen some tutorials and I've got to retrieve user id, profile pic and name from Facebook. My problem is the email, it comes null.
My current object is this:
User {#195 ▼
+token: "EAACYY1xBrzcBAO9KZAjZAZAZBQHWhbtZAb9lIXvH9Y6miRUiABImupk3ZCzHRxy2ZBxc9DU8f1ZAcrw0NEVMmy3GOQMSSyrmDTvMPyREvGm4pA1Ok6zI85LxES4Huy2ZCsxIUr2ISbLreLIv1ZACItUUoqqAnvVPyR4s0ZD"
+id: "989087311199546"
+nickname: null
+name: "MyName"
+email: null
+avatar: "https://graph.facebook.com/v2.2/mypicturecode/picture?type=normal"
+"user": array:2 [▼
"name" => "MyName"
"id" => "MyId"
]
}
and my controller is:
class FacebookController extends Controller
{
public function facebook()
{
return Socialite::driver('facebook')
->scopes(['email'])->redirect();
}
public function callback()
{
$user = Socialite::with('facebook')->user();
return dd($user);
// $user->token;
}
}
I recently discovered something. I have "guzzlehttp/guzzle": "~4.0" in my composer to avoid the cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) error. When the guzzle 4.0 is installed, Laravel Socialite returns to the 2.0.4 version. Looks like the 2.0.18 version deals with the email and first_name/last_name problem. The problem is that when guzzle 4.0 is installed, it requires the socialite 2.0.4