Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <route url="/V1/customers/authenticate/:email/:password" method="GET">
- <service class="MagentoCustomerApiAccountManagementInterface" method="authenticate"/>
- <resources>
- <resource ref="anonymous"/>
- </resources>
- </route>
- $userData = array("username" => "your_username", "password" => "your_password");
- $ch = curl_init("http://localhost/magento/index.php/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);
- $ch = curl_init("http://localhost/magento/index.php/rest/V1/customers/authenticate/".
- "roni_cost@example.com". //username/email
- "/".
- "roni_cost3@example.com" //password
- );
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));
- $result = curl_exec($ch);
- echo($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement