我在 Laravel 4 中创建一个 facebook 应用程序,问题是它在作为 facebook 应用程序运行时给我以下错误
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
但同样的事情在 facebook 上运行良好。我按照本教程 http://maxoffsky.com/code-blog/integrating-facebook-login-into-laravel-application/
以下是我的 routes.php
Route::get('home', 'HomeController@showWelcome');
Route::get('/', function() {
$facebook = new Facebook(Config::get('facebook'));
$params = array(
'redirect_uri' => url('/login/fb/callback'),
'scope' => 'email,publish_stream',
);
return Redirect::to($facebook->getLoginUrl($params));
});
Route::get('login/fb/callback', function() {
$code = Input::get('code');
if (strlen($code) == 0) return Redirect::to('/')->with('message', 'There was an error communicating with Facebook');
$facebook = new Facebook(Config::get('facebook'));
$uid = $facebook->getUser();
if ($uid == 0) return Redirect::to('/')->with('message', 'There was an error');
$me = $facebook->api('/me');
return Redirect::to('home')->with('user', $me);
});
编辑:我检查了 chrome 控制台并收到此错误
拒绝在框架中显示“ https://www.facebook.com/dialog/oauth?client_id=327652603940310&redirect_ur …7736c22f906b948d7eddc6a2ad0&sdk=php-sdk-3.2.3&scope=email%2Cpublish_stream”,因为它将“X-Frame-Options”设置为'否定'。