Php Laravel facebook sdk捆绑包注销不工作
我正在为Laravel使用bundle,除注销链接外,一切正常。当我单击“注销”时,我会被重定向,看起来一切都正常,但当它加载回页面时,我仍然登录 这可能是拉威尔的问题吗?它是否以不同的方式存储会话 我已经建立了这个类,但正如我所说的,我不认为这是一个问题,因为所有的工作都很好,除了注销会话没有得到清除 代码: 谢谢你的帮助!Php Laravel facebook sdk捆绑包注销不工作,php,facebook,laravel,Php,Facebook,Laravel,我正在为Laravel使用bundle,除注销链接外,一切正常。当我单击“注销”时,我会被重定向,看起来一切都正常,但当它加载回页面时,我仍然登录 这可能是拉威尔的问题吗?它是否以不同的方式存储会话 我已经建立了这个类,但正如我所说的,我不认为这是一个问题,因为所有的工作都很好,除了注销会话没有得到清除 代码: 谢谢你的帮助! 干杯 底层facebook php sdk使用内置php会话(默认情况下)存储持久信息,如经过身份验证的facebook用户id。 但是sdk不会自行销毁这些信息,因为
干杯 底层facebook php sdk使用内置php会话(默认情况下)存储持久信息,如经过身份验证的facebook用户id。 但是sdk不会自行销毁这些信息,因为很难判断何时会自动销毁 您可以使用facebook sdk对象上的方法清除此持久化信息。调用此方法的最佳位置是注销url的重定向回端点,因为这是访问者在facebook完成自己的注销后直接获得的位置 这看起来像:
// method on Fb class
public function destroySession() {
// just forward the call down to the sdk object
$this->ioc->destroySession();
}
您可能希望设置一条用户注销后到达的路由,并将其传递到getLogoutUrl()
中,如下所示:
// method on Fb class
public function logout(){
// tell explicity where to send the user when facebook is done, otherwise the current url will be used
return $this->ioc->getLogoutUrl(array('next' => URL::to_route('after_logout')));
}
Route::get('after_logout', array('as' => 'after_logout', 'do' => function() {
$fb = new Fb();
// call the session clearing
$fb->destroySession();
// send the user to its merry way
return Redirect::to('/');
}));
有这样一条路线:
// method on Fb class
public function logout(){
// tell explicity where to send the user when facebook is done, otherwise the current url will be used
return $this->ioc->getLogoutUrl(array('next' => URL::to_route('after_logout')));
}
Route::get('after_logout', array('as' => 'after_logout', 'do' => function() {
$fb = new Fb();
// call the session clearing
$fb->destroySession();
// send the user to its merry way
return Redirect::to('/');
}));