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

NAME

6       CURLOPT_USERPWD - user name and password to use in authentication
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL  *handle,  CURLOPT_USERPWD, char *user‐
12       pwd);
13

DESCRIPTION

15       Pass a char * as parameter, pointing to a zero terminated login details
16       string  for  the connection. The format of which is: [user name]:[pass‐
17       word].
18
19       When using Kerberos V5 authentication with a Windows based server,  you
20       should specify the user name part with the domain name in order for the
21       server to successfully obtain a Kerberos Ticket. If you don't then  the
22       initial part of the authentication handshake may fail.
23
24       When using NTLM, the user name can be specified simply as the user name
25       without the domain name should the server be part of  a  single  domain
26       and forest.
27
28       To  specify  the  domain  name  use either Down-Level Logon Name or UPN
29       (User Principal Name) formats. For example, EXAMPLE\user and user@exam‐
30       ple.com respectively.
31
32       Some  HTTP  servers  (on  Windows)  support inclusion of the domain for
33       Basic authentication as well.
34
35       When using HTTP and CURLOPT_FOLLOWLOCATION(3),  libcurl  might  perform
36       several  requests  to  possibly different hosts. libcurl will only send
37       this user and password information to hosts using the initial host name
38       (unless  CURLOPT_UNRESTRICTED_AUTH(3)  is  set),  so if libcurl follows
39       locations to other hosts it will not send  the  user  and  password  to
40       those. This is enforced to prevent accidental information leakage.
41
42       Use  CURLOPT_HTTPAUTH(3)  to specify the authentication method for HTTP
43       based connections or CURLOPT_LOGIN_OPTIONS(3) to control IMAP, POP3 and
44       SMTP options.
45
46       The user and password strings are not URL decoded, so there's no way to
47       send in a user name containing a colon  using  this  option.  Use  CUR‐
48       LOPT_USERNAME(3) for that, or include it in the URL.
49
50       The  application  does not have to keep the string around after setting
51       this option.
52

DEFAULT

54       NULL
55

PROTOCOLS

57       Most
58

EXAMPLE

60       CURL *curl = curl_easy_init();
61       if(curl) {
62         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
63
64         curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
65
66         ret = curl_easy_perform(curl);
67
68         curl_easy_cleanup(curl);
69       }
70

AVAILABILITY

72       Always
73

RETURN VALUE

75       Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was  insuf‐
76       ficient heap space.
77

SEE ALSO

79       CURLOPT_USERNAME(3), CURLOPT_PASSWORD(3), CURLOPT_PROXYUSERPWD(3),
80
81
82
83libcurl 7.69.1                  August 24, 2017             CURLOPT_USERPWD(3)
Impressum