I have an issue while using end point of magento-2. I need to do the authentication using mobile no and password rather than email. I am explaining my code below.

$ch1 = curl_init();
$data1 = array("username" => '9438835610', "password" => 'Abcdeg123@');

$data_string1 = json_encode($data1);                       
$ch1 = curl_init($adminUrl1); 
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch1, CURLOPT_POSTFIELDS, $data_string1);                                                                  
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch1, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',                                                                                
    'Content-Length: ' . strlen($data_string1))                                                                       
$token1 = curl_exec($ch1);
$result = json_decode($token1, 1);
echo json_encode($result);

Here I need to login customer using Mobile no and password. Please help me to resolve this issue.

1 Answer 1


Using mobile number you not get token. For that follow below step. Take 2 param 1) mobilenumner and pasword

  1. Using mobile number to get user email address from custom api
  2. Then call magento token api in pass user "email address" and "password" $adminUrl1='http://example.com/index.php/rest/V1/integration/customer/token';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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