Fully disable cookies in Laravel 4 API

前端 未结 7 522
余生分开走
余生分开走 2020-12-14 04:58

I am using Laravel to build a RESTful API. I use Basic HTTP Auth (Authenticate header), with this filter:



        
7条回答
  •  醉话见心
    2020-12-14 05:21

    you need to create your filter like follws in laravel 4, 4.2

    Route::filter('no.session.cookie', function()
    {
        Config::set('session.driver', 'array');
        Config::set('cookie.driver', 'array');
    });
    

    In laravel 5, 5.1 set middleware handle() like follows

    public function handle($request, Closure $next){
      \Config::set('session.driver', 'array');
      \Config::set('cookie.driver', 'array');
     return $next($request);
    }
    

提交回复
热议问题