I need to add basic auth to my sanctum api

Viewed 263

I'm using laravel sanctum and I add to middleware to my route:

Route::group(['middleware' => 'auth:sanctum'], function () {
    Route::post('/sms-log',[SmsLogController::class, 'store'] );
});

But insomnia wants me to sign in: insomnia_ss

when I remove middleware from API route working as expected. so how can I add basic auth?

1 Answers

In insomnia add a header so you don't get redirected to the login route, instead you get a "message":" Not authenticated."

Accept: application/json
Related