V
V
villager1232019-08-17 13:25:01
PHP
villager123, 2019-08-17 13:25:01

Authorization in SPA using PHP SESSION, why cookies are not saved?

I am authorizing. Client on Vue, communicating with the server using Axios.
Successful authorization calls the sendData function, which sends data to the client and saves the session. The session_start() is called above.

if ((is_array($response) && count($response) != 0) && password_verify($parse_data['password'], $response['password'])) {

                $_SESSION['logged_user'] = $response['id_user'];
                sendData([
                    "status"=> true,
                    "data"=> $response
                ]);

            }

function sendData ($send_data) {
    header('Content-type: application/json; charset=UTF-8"');
    echo json_encode($send_data);
}

Cookies are received in response, but are not stored in the browser.
5d57d55050f1a412834694.png
Maybe you need to transfer some headers, or set up a function? Tell me plz

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
villager123, 2019-08-17
@villager123

If anyone encounters a similar issue, please read here and here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question