I am having troubles in logging in with Facebook.
I am using Laravel Socialite, I have followed all the instructions but I am having problems at method callback.
This is what i do :
public function redirectToFacebook()
{
return Socialite::driver('facebook')->redirect();
}
public function handleFacebookCallback()
{
$userSocial = Socialite::driver('facebook')->user();
//return $userSocial;
$finduser = User::where('facebook_id', $userSocial->id)->first();
if($finduser){
Auth::login($finduser);
return Redirect::to('/');
}else{
$new_user = User::create([
'name' => $userSocial->name,
'email' => $userSocial->email,
'image' => $userSocial->avatar_original,
'facebook_id' => $userSocial->id
]);
Auth::login($new_user);
return redirect()->back();
}
}
SQLSTATE[HY000]: General error: 1364 Field 'password' doesn't have a default value
How to get the password of facebook?