laravel csrf_token() is empty in l5-swagger
csrf_token() is empty in l5-swagger and couldn't do any request.
I have tried to request it from the postman and it works. but in swagger, it didn't. I have taken a look from this link (Laravel 5 csrf_token value is Empty) but I still have no idea how to solve my problem.
How can I get the csrf_token inside my l5-swagger view?
Answer
You should try to add this in /routes/web.php
Route::group(['middleware' => 'web'], function () { Route::get('api/documentation', '\L5Swagger\Http\Controllers\SwaggerController@api')->name('l5swagger.api'); });