Basic authentication middleware

Hi,
at first i’d like to notice that i’m a noob when it comes to creating api endpoints and i’m struggling to overcome my bug but no results yet :confused:
I have such route:

Route::group(['prefix' => 'api/v3/', 'middleware' => 'auth.basic'], function() {

    //Products
    Route::get('/products/{id}', [ProductsController::class, 'getProduct']);

    Route::get('/products', [ProductsController::class, 'index']);
});

when trying to access either endpoint i get error saying:

Target [Illuminate\Contracts\Auth\Factory] is not instantiable while building [Illuminate\Auth\Middleware\AuthenticateWithBasicAuth]

is there something else i need to configure to make this work properly?

without middleware all is working as expected, but i want to add this basic auth.

Many thanks

Hey @Mateusz

Have you installed the latest RainLab.User plugin? This plugin introduces an instance that satisfies this contract.

Best regards

Hey @daft

i’ve updated RainLab.User to the latest version, it seems to fix error i’ve mentioned above, that’s awesome!
But now i don’t know which credential should i use to authenticate :confused:

i’ve read in laravel docs that i should use email from username column, i’m also using a password from this user, but nothing seem to be working (testing with REST Client VSC plugin).
I don’t get any prompt to enter credentials either (don’t know if i should though).

Best regards