---
name: "CURLOPT_SOCKS5_AUTH"
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_SOCKS5_AUTH"
---

# CURLOPT\_SOCKS5\_AUTH(3)

methods for SOCKS5 proxy authentication

## NAME

CURLOPT\_SOCKS5\_AUTH - methods for SOCKS5 proxy authentication

## SYNOPSIS

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

## DESCRIPTION

Pass a long as parameter, which is set to a bitmask, to tell libcurl which authentication method(s) are allowed for SOCKS5 proxy authentication. The only supported flags are *CURLAUTH\_BASIC*, which allows username/password authentication, *CURLAUTH\_GSSAPI*, which allows GSS-API authentication, and *CURLAUTH\_NONE*, which allows no authentication. Set the actual user name and password with the *[CURLOPT\_PROXYUSERPWD(3)](/CURLOPT_PROXYUSERPWD/3.md)* option.

## DEFAULT

CURLAUTH\_BASIC\|CURLAUTH\_GSSAPI

## PROTOCOLS

All

## EXAMPLE

```
int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    /* request to use a SOCKS5 proxy */
    curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://user:pass@myproxy.com");
    /* enable username/password authentication only */
    curl_easy_setopt(curl, CURLOPT_SOCKS5_AUTH, (long)CURLAUTH_BASIC);
    /* Perform the request */
    curl_easy_perform(curl);
  }
}
```

## AVAILABILITY

Added in 7.55.0

## RETURN VALUE

Returns CURLE\_OK if the option is supported, CURLE\_UNKNOWN\_OPTION if not, or CURLE\_NOT\_BUILT\_IN if the bitmask contains unsupported flags.

## SEE ALSO

[**CURLOPT\_PROXY**(3)](/CURLOPT_PROXY/3.md), [**CURLOPT\_PROXYTYPE**(3)](/CURLOPT_PROXYTYPE/3.md)
