Я следовал 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'); });
И я получаю вывод, как это http://localhost:8000/callback?code=AQA6Puy_f4xgBMkhHV7Wa6Q-WhPz5zoXrXPGQquyVzHgHagWGtlVxNTX_6oL6C7yQ8TM1x7ri3VbwhssjxkNd-6EAcBr7SfigWEhs0RXOHGon7t68bQFKegLmhSWwajQZJahd3paBfWv6tdVui8gDU-jsyPOOl5UU3JqsY4f7GkmzxaGLBE-84rjBBFfv8h-ewTVtUJQMMvLsJQpbKJkwj2OYT0L2_Xzfm7TUvg6y2q_Jv9kYV3OqD-f4WlIG25w46WOlpFYvVEBBA_iK31hF1HRI_s5XcW70VQ_bjxo7C-k0fV3-R3KFmrRBy9qrFWGC2U4pBDXYEI2B3p1IUMJ8i_H&state=GiH7OUD4therEmiBVO2vOYTMVhEHhb8QPffgcIpV#=