I am trying to implement laravel passport on laravel 6. But I am getting an error.
Login and registration are ok. But I am getting an error when trying to fetch(authentic) pages.
The error is here pastebin.com/1M4iC3u5
My api.php
Route::group(['prefix'=>'v1'],function(){
Route::post('register', 'API\Auth\RegisterController@register');
Route::post('login', 'API\Auth\RegisterController@login');
Route::get('gas_stations', 'API\GasStationController@index');
//it works
//Route::get('brands', 'API\BrandController@index');
Route::group(['middleware'=>['auth:api']],function() {
//it is not working
Route::get('brands', 'API\BrandController@index');
});
});
I am trying to implement laravel passport on laravel 6. But I am getting an error.
Login and registration are ok. But I am getting an error when trying to fetch(authentic) pages.
The error is here pastebin.com/1M4iC3u5
My api.php
I don't know how you have set up the flow but here is something that should probably work.
Inside the BrandController add this to the constructor.
Next, the index function inside the controller should look like this:
Then use the Route directly as:
Thanks a lot