Ad

Csrf_token() Is Empty In L5-swagger And Couldn't Do Any Request Except GET Request

- 1 answer

csrf_token() is empty in l5-swagger and couldn't do any request except GET because the header is missing and always getting 419 error code

I have tried to request it from 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?

Ad

Answer

I think you should try to add this in /routes/web.php

Route::group(['middleware' => 'web'], function () {
    Route::get('api/documentation', '\L5Swagger\Http\Controllers\[email protected]')->name('l5swagger.api');
});

so you can add the web middleware on l5-swagger route

hope it helps

Ad
source: stackoverflow.com
Ad