I have two servers which are written in yii2 and magento respectively. The yii2 application has file module and magento has commerce and user module. the current problem is whenever user needs to upload the file to yii2, user only sends the access token. How do i retrieve user details (id) from the magento using only access token?


  • specific customer user, but i want to retrieve the user details using the token not id. I want to retrieve it from the other servers using oauth – Robert Limanto Sep 4 '17 at 6:09

First create token from Admin->System->integrations then use below code.

$ch = curl_init("http://your_domain.com/index.php/rest/V1/customers/search?searchCriteria");
$token = 'your_token';

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . $token));

$result = curl_exec($ch);
$result = json_decode($result, true);

Hope this will help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.