Answer the question
In order to leave comments, you need to log in
Laravel: Is CSRF protection needed in API?
I am implementing a small API, everything is installed initially out of the box.
Route::apiResources([
'/events' => 'API\EventsController',
'/schedulers' => 'API\Schedulers Controller',
]);
Answer the question
In order to leave comments, you need to log in
For the API, laravel already has a middleware group api
in app\Http\Kernel.php
.
CSRF protection is not designed to protect APIs. API Authentication (Passport)
We need details on how you authorize the user through the API, because there is a suspicion that you do not give an authorization token during this authorization or do not use it when making requests to secure nodes.
And yes. CSRF does not work in API requests, since sessions are used to store the verification token, which, in turn, are not used in the API.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question