Contributions
Basic authentication with php cURL end point is Swagger
Hello every one, I just joined in this community and this is my first post. I have been assigned a task to communicate with Swagger test api with basic authentication. I am using PHP to communicate. I have been provided by username, password , client id and client secret. Here I have a doubt where to pass client id and secret ? Below is my code with username and password <?php $username = 'user_name'; $password = 'pass_word'; $client_id = 'some_clinet_id'; $secret = 'client_secret'; $url = 'http://sometest.com/v1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $return = curl_exec($ch); Now I was in a confusing state where and how to pass these two variables $client_id = 'some_clinet_id'; $secret = 'client_secret'; Any help would be greatly appreciated.1.4KViews0likes0Comments