cancel
Showing results for 
Search instead for 
Did you mean: 

Adminpassword in API REST

Adminpassword in API REST

Hi,

 

I call to Magento API rest using curl for have an authentification token, take datas and put them in a custom table.

 

Spoiler
$userData = array("username" => $this->getMagentoUsername(), "password" => "mypassword");
$ch = curl_init("http://localhost/magento2/rest/V1/integration/admin/token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json""Content-Lenght: " . strlen(json_encode($userData))));
$token = curl_exec($ch);

I would like to retrieved adminpassword  but I can't because is hash.

The token is generated but I would like the password to be automatically written and not written by myself.

Like that, when an admin connects, it will be immediately authorized.

 

Thanks