I am trying to add csrf in my laravel web app as meta tag -
<meta name="csrf-token" content="{{ csrf_token() }}">
but the value is empty when I browse it -
<meta name="csrf-token" content="">
I have also tried adding in login form also -
as {!! csrf_filed() !!}
or
<input type="hidden" name="_token" value="{{ csrf_token() }}">
but in both case value is null. I am using Angularjs in front end, does it have to do anything with that?
Put you routes inside the route group 'middleware':
Route::group(['middleware' => ['web']], function () {
// your routes here
});
And run this:
php artisan key:generate