---
name: "CURLOPT_PROXYAUTH"
section: "3"
platform: "macos"
package: "curl"
version: "166.0.0.0.1"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/CURLOPT_PROXYAUTH"
---

# CURLOPT\_PROXYAUTH(3)

HTTP proxy authentication methods

## NAME

CURLOPT\_PROXYAUTH - HTTP proxy authentication methods

## SYNOPSIS

```
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYAUTH, long bitmask);
```

## DESCRIPTION

Pass a long as parameter, which is set to a bitmask, to tell libcurl which HTTP authentication method(s) you want it to use for your proxy authentication. If more than one bit is set, libcurl first queries the site to see what authentication methods it supports and then it picks the best one you allow it to use. For some methods, this induces an extra network round-trip. Set the actual name and password with the *[CURLOPT\_PROXYUSERPWD(3)](/CURLOPT_PROXYUSERPWD/3.md)* option.

The bitmask can be constructed by the bits listed and described in the *[CURLOPT\_HTTPAUTH(3)](/CURLOPT_HTTPAUTH/3.md)* man page.

## DEFAULT

CURLAUTH\_BASIC

## PROTOCOLS

HTTP

## EXAMPLE

```
int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode ret;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    /* use this proxy */
    curl_easy_setopt(curl, CURLOPT_PROXY, "http://local.example.com:1080");
    /* allow whatever auth the proxy speaks */
    curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
    /* set the proxy credentials */
    curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "james:007");
    ret = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}
```

## AVAILABILITY

Added in 7.10.7

## RETURN VALUE

Returns CURLE\_OK if the option is supported, CURLE\_UNKNOWN\_OPTION if not, or CURLE\_NOT\_BUILT\_IN if the bitmask specified no supported authentication methods.

## SEE ALSO

[**CURLOPT\_HTTPAUTH**(3)](/CURLOPT_HTTPAUTH/3.md), [**CURLOPT\_PROXY**(3)](/CURLOPT_PROXY/3.md), [**CURLOPT\_PROXYPORT**(3)](/CURLOPT_PROXYPORT/3.md), [**CURLOPT\_PROXYTYPE**(3)](/CURLOPT_PROXYTYPE/3.md), [**CURLOPT\_PROXYUSERPWD**(3)](/CURLOPT_PROXYUSERPWD/3.md)
