我关注了Laravel 5.2 Socialite Facebook Login,但无法获取输出。
我当前的Laravel版本是5.3。
Services.php
'facebook' => [
'client_id' => 'my appid',
'client_secret' => 'my client secret',
'redirect' => 'http://localhost:8000/callback',
],
我的控制器
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Socialite;
class SocialAuthController extends Controller
{
public function redirect()
{
return Socialite::driver('facebook')->redirect();
// print_r($test); exit;
}
public function callback()
{
$providerUser = \Socialite::driver('facebook')->user();
//print_r($providerUser); exit;
}
}
routes.php
Route::group(['middleware' => ['web']], function () {
Route::get('/callback', 'SocialAuthController@callback');
Route::get('/redirect', 'SocialAuthController@redirect');
});