我在Laravel 5.1上安装Social alite插件时遇到了问题。
首先我有这个控制器。php代码:
public function redirectToProvider($provider)
{
return Socialite::driver($provider)->redirect();
}
public function handleProviderCallback($provider)
{
//notice we are not doing any validation, you should do it
$user = Socialite::driver($provider)->user();
// stroing data to our use table and logging them in
$data = [
'name' => $user->getName(),
'email' => $user->getEmail()
];
// Here, check if the user already exists in your records
$my_user = User::where('email','=', $user->getEmail())->first();
if($my_user === null) {
Auth::login(User::firstOrCreate($data));
} else {
Auth::login($my_user);
}
//after login redirecting to home page
return redirect($this->redirectPath());
}
route.php:
Route::get('/social/login/redirect/{provider}', ['uses' => 'Auth\AuthController@redirectToProvider', 'as' => 'social.login']);
Route::get('/social/login/{provider}', 'Auth\AuthController@handleProviderCallback');
现在,当我尝试我的域时:http://mydomain.me/social/login/redirect/facebook
还我:
http://mydomain.me/social/login/facebook?code=AQAl29aq2-rX9L5-9GmiIwqstR-ETC ETC ETC#_=_
这里有什么问题?
我试图将域从null更改为“mydomain”。我正在开会。php,并尝试:
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan clear-compiled
这又不行了。
/social/login/facebook
中返回状态
查询字符串。您能否确认您可以在重定向URL中看到查询字符串(即,当您看到facebook登录页面时)李>