P
P
Paul Krivenko2018-03-06 21:42:29
JavaScript
Paul Krivenko, 2018-03-06 21:42:29

How to check if the user is authenticated (laravel) when requesting from the client (js)?

Good day. I need to implement a mechanism for changing user data by sending an asynchronous request from javascript when the value in the input changes. So, when I accept this request on the server, I need to authenticate the user. The server is written in laravel. Tell me how to do it

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladislav Nagorny, 2018-03-06
@esvils

Api authorization JWT - example here

D
Dmitry Kuznetsov, 2018-03-07
@dima9595

Take a look at Laravel Passport. With the help of it, I did a check on the user.

A
ajaxtelamonid, 2018-03-08
@ajaxtelamonid

Do you need to check if the user is authenticated? Check in the usual way, as if the request is not Ajax. With an Ajax request, cookies are transmitted, there is authentication data there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question