Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用homestead作为服务器通过电子邮件登录laravel_Laravel_Google Signin_Homestead - Fatal编程技术网

使用homestead作为服务器通过电子邮件登录laravel

使用homestead作为服务器通过电子邮件登录laravel,laravel,google-signin,homestead,Laravel,Google Signin,Homestead,我想在Laravel项目中使用google登录。但它不能正常工作。我做了很多事情,但它帮不了我。现在我正在用homestead测试它 这里是路线 Route::get('login/google','Auth\LoginController@redirectToGoogle')->name('login.google') Route::get('login/google/callback','Auth\LoginController@handleGoogleCallback'); 这是登录控制器

我想在Laravel项目中使用google登录。但它不能正常工作。我做了很多事情,但它帮不了我。现在我正在用homestead测试它

这里是路线

Route::get('login/google','Auth\LoginController@redirectToGoogle')->name('login.google')
Route::get('login/google/callback','Auth\LoginController@handleGoogleCallback');

这是登录控制器

public function redirectToGoogle()
{
    return Socialite::driver('google')->redirect();
}
public function handleGoogleCallback()
{
    $google_user = Socialite::driver('google')->user();
    $user = User::where('email', $google_user->getEmail())->first();

    if($user){
        Auth::login($user);
        return redirect('/');
    }else{
        $newUser = User::create([
            'name' => $user->name,
            'email' => $user->email,
            'user_type' => UserTypes::SystemUser,
        ]);

        Auth::login($newUser);
        return redirect('/');
    }
}
我使用此按钮在谷歌登录时重定向

当我点击继续谷歌,得到这个错误

尝试使用域名更改本地名称?但我使用的是homestead,在那里我定义了gws.test