A
A
Alexander2017-01-30 10:24:03
Laravel
Alexander, 2017-01-30 10:24:03

How to correctly send _token via POSTMAN to server?

d919ec813e4f426fa053ccc78f31b466.png
I send data to the server, but it gives an error TokenMismatchException Disable the
token:

protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
      //      \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

Response from server:
array:2 [
  "_token" => "jBIy2c0Gsk7zjNbs8RW0uB61tkSPlXGVdIXLr6Xy"
  "another_value" => "True"
]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Vardugin, 2017-01-30
@Aizlee

In App\Http\Middleware\VerifyCsrfToken write:
protected $except = [
'api/*'
];
https://laravel.com/docs/5.4/csrf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question