I am using PHP for writing an Api. The Api is called by a react web client. I am using Axio to call the Api. When I send something to my Api, the SessionID is not persistent, it changes after every call. Does someone have any idea?
The simplified PHP-Api:
<?php
session_start();
echo session_id();
/*
//Doesnt mather
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token');
header('Content-type: application/json; charset=utf-8');
*/
?>
The simplified React-Client
static vote(vote, callback)
{
const data = {
action: 'vote',
vote: vote,
}
axios.post(api_url, qs.stringify(data))
.then(callback)
.catch((error) => {
console.log(error);
});
}