I need to send cookies between two websites, website A and website B
Website A code: (JS)
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://websiteb.com/?sessid=<?php echo session_id(); ?>', true);
xhr.withCredentials = true;
xhr.send(null);
Wesbite B code: (PHP)
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Headers: Set-Cookie");
header("Access-Control-Allow-Origin: https://websiteA.tld");
header('Content-Type: application/json');
setcookie('PHPSESSID', $_GET['sessid'], array(
'expires' => time() + $cookielifetime,
'path' => '/',
'secure' => true,
'httponly' => false,
'SameSite' => 'None'
));
This code only works on my machine, but not an external device.
Here are postman logs, however i only get website A's cookies.