I have a laravel API and in it, I need to authenticate access requests. So I used Passport Laravel, but according to the API return, there is some definition that I did not report in my code.
In my route, I type the middleware type:
Route::get('/members', 'PessoaController@index')->middleware('auth:api');
In config / app.php I informed the class
Laravel\Passport\PassportServiceProvider::class,
Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
But when I make any requests in my API, I have the following return:
(1/1) FatalThrowableError Type error: Argument 1 passed to Laravel \ Passport \ Http \ Middleware \ CreateFreshApiToken :: __ construct () must be an instance of Laravel \ Passport \ ApiTokenCookieFactory, instance of Illuminate \ Foundation \ Application given, called in /home/secbase.com. br / vendor / laravel / framework / src / Illuminate / Foundation / ProviderRepository.php on line 208