by Juan Leyva.
Hi,
use login/token.php, it requires username, password and service (a service defined in the Moodle site)
It will return a JSON object containing the user token
More info here: https://docs.moodle.org/dev/Creating_a_web_service_client#How_to_get_a_user_token
Regards, Juan