1CURLOPT_USERNAME(3)        curl_easy_setopt options        CURLOPT_USERNAME(3)
2
3
4

NAME

6       CURLOPT_USERNAME - user name to use in authentication
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERNAME,
12                                 char *username);
13

DESCRIPTION

15       Pass a char * as parameter, which should be pointing to the null-termi‐
16       nated user name to use for the transfer.
17
18       CURLOPT_USERNAME(3) sets the user name to be used in protocol authenti‐
19       cation.  You  should not use this option together with the (older) CUR‐
20       LOPT_USERPWD(3) option.
21
22       When using Kerberos V5 authentication with a Windows based server,  you
23       should  include the domain name in order for the server to successfully
24       obtain a Kerberos Ticket. If you don't then the  initial  part  of  the
25       authentication handshake may fail.
26
27       When using NTLM, the user name can be specified simply as the user name
28       without the domain name should the server be part of  a  single  domain
29       and forest.
30
31       To  include  the  domain  name  use either Down-Level Logon Name or UPN
32       (User Principal Name) formats. For example, EXAMPLE\user and user@exam‐
33       ple.com respectively.
34
35       Some  HTTP  servers  (on  Windows)  support inclusion of the domain for
36       Basic authentication as well.
37
38       To specify the password and login options, along with  the  user  name,
39       use the CURLOPT_PASSWORD(3) and CURLOPT_LOGIN_OPTIONS(3) options.
40
41       The  application  does not have to keep the string around after setting
42       this option.
43

DEFAULT

45       blank
46

PROTOCOLS

48       Most
49

EXAMPLE

51       CURL *curl = curl_easy_init();
52       if(curl) {
53         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
54
55         curl_easy_setopt(curl, CURLOPT_USERNAME, "clark");
56
57         ret = curl_easy_perform(curl);
58
59         curl_easy_cleanup(curl);
60       }
61

AVAILABILITY

63       Added in 7.19.1
64

RETURN VALUE

66       Returns CURLE_OK if the option is  supported,  CURLE_UNKNOWN_OPTION  if
67       not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
68

SEE ALSO

70       CURLOPT_USERPWD(3),   CURLOPT_PASSWORD(3),   CURLOPT_HTTPAUTH(3),  CUR‐
71       LOPT_PROXYAUTH(3)
72
73
74
75libcurl 7.71.1                   June 25, 2020             CURLOPT_USERNAME(3)
Impressum