0

In laravel 5.8 my swagger documentation is displaying fine but when I enter execute then its coming with 'Could not render n, see the console.' error. enter image description here

composer.php

 "darkaonline/l5-swagger": "5.8.*"

what can be the reason? anyone please suggest. TIA

Md imran
  • 57
  • 1
  • 2
  • 9

2 Answers2

1

I just had a similar issue but with Laravel 7.26.x. Issue related to the CSRF Token.

On my swagger blade I removed from the body

requestInterceptor: function () {
    this.headers['X-CSRF-TOKEN'] = '{{ csrf_token() }}';
    return this;
},

and added instead

<meta name="csrf-token" content="{{ csrf_token() }}">

Also don't forget to add in your web routes

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

you can make it okey by passing the request through that functions.

 requestInterceptor: function(request) {
      request.headers['X-CSRF-TOKEN'] = '{{ csrf_token() }}';
      return request;
    }
Md imran
  • 57
  • 1
  • 2
  • 9