curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

libcurl in C++ Access Denied

From: Jeremy via curl-library <>
Date: Thu, 29 Sep 2022 16:45:41 -0400


Can someone please help me figure out the cURL library in C++? This is
the main part of the code I am trying:

     curl_easy_setopt(curl, CURLOPT_URL,
     curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
     curl_easy_setopt(curl, CURLOPT_USERPWD, "username:password");
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
     res = curl_easy_perform(curl);

However, it returns this message: "HTTP Basic: Access denied."

I also tried this with the same result:

         curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

This works:

     curl -u "username:password"

Thank you


Received on 2022-09-29