参数app_id是必需的Socialite

时间:2017-12-20 18:34:39

标签: php laravel laravel-5 facebook-javascript-sdk laravel-socialite

routes.php文件

Route::get('login/facebook', 'Auth\LoginController@redirectToProvider');
Route::get('login/facebook/callback', 'Auth\LoginController@handleProviderCallback');

Services.php

'facebook' => [
    'client_id' => env('FB_KEY','188636635048329'),         // Your facbook Client ID
    'client_secret' => env('FB_SECRET','d16af66a2e168d05d87e76d618b48225'), // Your facbook Client Secret
    'redirect' => 'FB_CALLBACK','http://localhost:8000/login/facebook/callback',
],

LoginController.php

public function redirectToProvider()
{
    return Socialite::driver('facebook')->redirect();
}
public function handleProviderCallback()
{
    $user = Socialite::driver('facebook')->user();
    return $user->token;
}

我跟进了laravel社交网站文档,但它没有工作只是显示参数app_id是必需的我试图清除Config缓存,但它既没有工作也没有 我试图放入.env文件

FB_KEY = 188636635048329
FB_SECRET=d16af66a2e168d05d87e76d618b48225
FB_CALLBACK=http://localhost:8000/login/facebook/callback 

但它没有用,所以我还能做些什么才能让它发挥作用

1 个答案:

答案 0 :(得分:0)

<强>溶液

错误发生在.env文件中我在FB_KEY中留下了一些空间所以它应该是那样的

FB_KEY=188636635048329