R
R
Rishat Sultanov2017-08-10 12:08:28
Laravel
Rishat Sultanov, 2017-08-10 12:08:28

Why are the tokens different?

Why are the tokens different?
Laravel 3

string(84) "ctwbm1eCTLlUrjbhlYRMaag3xUDoTN6ivQZxdSRP    kU2szANMoSpsby0WHNG2NSxJjLIXJ23Cs8slliOD"

Route::filter('engine_csrf', function()
  {
    $token = (!Request::ajax() and Request::method() === 'GET') ? Session::token()  : Input::get(Session::csrf_token);

    if (Request::ajax())
    {
      $token = is_array($token = Request::header('x-csrf-token')) ? Arr::getItem($token, 0) : $token;
    }

    if (Session::token() != $token)
    {
      dd(Session::token().'    '.$token);
      return Response::make('<h3 style="color:#d00">Invalid authenticity token</h3>', 403);
    }
  });

  if (Config::get('application.ssl') and !Request::secure() and !Request::cli())
  {
    header('Location: '.URL::to(URI::current(), true, false, false), true, 301);
    exit;
  }
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question