I created a simple web-site for my blynk needs and here i want to share php code that perform authentication to Blynk Admin Panel( i need this to get all users json data ).Code:
<?php
$host = 'Define your own';
$login = 'Define your own';
$pass = 'Define your own';
/* Crypt */
$ctx = hash_init('sha256');
hash_update($ctx, $pass);
hash_update($ctx, hash('sha256', strtolower($login), true));
$hash = base64_encode( hash_final($ctx, true) );
/* Auth */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://'.$host.':8080/admin/login');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath('.').'/'.microtime().'cookie.txt');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'email' => $login,
'password' => $hash
]));
$result = curl_exec($ch);
curl_reset($ch);
/* Get Data */
curl_setopt($ch, CURLOPT_URL, 'http://'.$host.':8080/admin/users?_page=1&_perPage=50&_sortDir=DESC&_sortField=lastModifiedTs');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$users = curl_exec($ch);
curl_close($ch);