Answer the question
In order to leave comments, you need to log in
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);
}
Answer the question
In order to leave comments, you need to log in
If anyone encounters a similar issue, please read here and here .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question