使用Facebook登录无法正确重定向

时间:2018-09-06 05:58:42

标签: php laravel facebook

我关注了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#=

0 个答案:

没有答案