jeggybutdoubleg
jeggybutdoubleg

Reputation: 80

I need to add basic auth to my sanctum api

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?

Upvotes: 2

Views: 514

Answers (1)

Aslam H
Aslam H

Reputation: 1801

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

Upvotes: 2

Related Questions