Laravel 5.2 - 仅使用电子邮件登录

Abr*_*hin 4 php facebook-login laravel laravel-5 laravel-5.2

我正在尝试使用Laravel 5.2创建社交登录

我收到了user-email,所以我只需要使用该 email登录。

所以,我所做的是——

Auth::attempt(
                [
                    'email' => $user->email
                ]);
Run Code Online (Sandbox Code Playgroud)

但我收到此错误-

ErrorException in EloquentUserProvider.php line 112:
Undefined index: password
Run Code Online (Sandbox Code Playgroud)

更多详情-

在此处输入图片说明

Abr*_*hin 6

我是这样解决的——

//Get the user
$user = User::where('email', '=', $user->email)->first();
//Now log in the user if exists
if ($user != null)
{
    Auth::loginUsingId($user->id);
}
Run Code Online (Sandbox Code Playgroud)

它现在正在工作:)。