I need to create the same request in AJAX.
Can somebody advice me how to include authentication?
i tried user/pass as GET Parameters and change URL to
https://user:pwd@www.example.com/token
i use vue-resource but can also use jQuery.ajax or axios
$username = 'user';
$password = 'pwd';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, 'https://www.example.com/token');
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_handle, CURLOPT_USERPWD, $username . ':' . $password);
curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);