Answer the question
In order to leave comments, you need to log in
How to make csrf protection for api requests?
Hi, tell me, how to make protection from csrf for API routes?
I have a nuxt SPA application on the front, with authorization via api Route::group(['middleware' => 'auth:api'])
Everything is clear for the admin - when authorizing by login and password, he receives an api_token, which I save in the session
But how to be there I want to make a form that the guest must fill out, without authorization at all? How to make protection from csrf?
Should I make some kind of ajax request to get the csrf token or what?
Answer the question
In order to leave comments, you need to log in
CSRF has nothing to do with it. It's not made for antispam sake
Antispam - I hope you highlighted that word above.
Can skip cross-domain requests only from the domain on which the front is spinning? If not suitable, then make such an intermediary only for the form route
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question