I'm trying to implement the new login as described in https://help.infiniteautomation.com/mango-rest-api-authentication/ but I keep getting a response of 401 Unauthorized. admin/admin is a valid login at the address provided in CURLOPT_URL, and $_SESSION['token'] is set. This is in PHP, using Mango v3.0.2, Windows 8, Chrome 57
$token = $_SESSION['token'];
$authentication = array();
$authentication['username'] = 'admin';
$authentication['password'] = 'admin';
$curl = curl_init();
$headers = array(
'Accept: application/json',
'logout: true',
'Cookie:XSRF-TOKEN='.$token,
'X-XSRF-TOKEN:'.$token
);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_VERBOSE => TRUE,
CURLOPT_HEADER => TRUE,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => json_encode($authentication),
CURLOPT_URL => 'http://<ip_address>:8080/rest/v2/login/'
));
$response = curl_exec($curl);