Laravel 419 error on POST request via POSTMAN
It may be because you are not sending your csrf token with the form data.
In laravel it is mandatory to send the csrf token on every request.
If you don't want to send then mention you method name in the app/http/middleware/VerifyCsrfToken.php
file.
<?phpnamespace App\Http\Middleware;use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;class VerifyCsrfToken extends Middleware{ protected $addHttpCookie = true; protected $except = [ 'auth/facebook/callback', 'auth/google/callback',];}
I was having the same problem and the only solution that I found was removing that exact url from the csrf verification file, which name is VerifyCsrfToken.php
and is located at
app\Http\Middleware\VerifyCsrfToken.php
Once you open that file, you only have to put the exact url that you are doing your post request in the except variable like below:
<?phpnamespace App\Http\Middleware;use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;class VerifyCsrfToken extends Middleware{ /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ // 'http://localhost/api2/public/user' //This is the url that I dont want Csrf for postman. ];}
After that I could do my post request from postman.
PD: This is for development environments I suppose that you eventually will have to undo this, so, someone correct me if I'm wrong.