1 .\" **************************************************************************
3 .\" * Project ___| | | | _ \| |
4 .\" * / __| | | | |_) | |
5 .\" * | (__| |_| | _ <| |___
6 .\" * \___|\___/|_| \_\_____|
8 .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
21 .\" **************************************************************************
23 .TH CURLOPT_USERPWD 3 "August 24, 2017" "libcurl 7.59.0" "curl_easy_setopt options"
26 CURLOPT_USERPWD \- user name and password to use in authentication
28 #include <curl/curl.h>
30 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USERPWD, char *userpwd);
32 Pass a char * as parameter, pointing to a zero terminated login details string
33 for the connection. The format of which is: [user name]:[password].
35 When using Kerberos V5 authentication with a Windows based server, you should
36 specify the user name part with the domain name in order for the server to
37 successfully obtain a Kerberos Ticket. If you don't then the initial part of
38 the authentication handshake may fail.
40 When using NTLM, the user name can be specified simply as the user name
41 without the domain name should the server be part of a single domain and
44 To specify the domain name use either Down-Level Logon Name or UPN (User
45 Principal Name) formats. For example, EXAMPLE\\user and user@example.com
48 Some HTTP servers (on Windows) support inclusion of the domain for Basic
49 authentication as well.
51 When using HTTP and \fICURLOPT_FOLLOWLOCATION(3)\fP, libcurl might perform
52 several requests to possibly different hosts. libcurl will only send this user
53 and password information to hosts using the initial host name (unless
54 \fICURLOPT_UNRESTRICTED_AUTH(3)\fP is set), so if libcurl follows locations to
55 other hosts it will not send the user and password to those. This is enforced
56 to prevent accidental information leakage.
58 Use \fICURLOPT_HTTPAUTH(3)\fP to specify the authentication method for HTTP
59 based connections or \fICURLOPT_LOGIN_OPTIONS(3)\fP to control IMAP, POP3 and
62 The user and password strings are not URL decoded, so there's no way to send
63 in a user name containing a colon using this option. Use
64 \fICURLOPT_USERNAME(3)\fP for that, or include it in the URL.
66 The application does not have to keep the string around after setting this
74 CURL *curl = curl_easy_init();
76 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
78 curl_easy_setopt(curl, CURLOPT_USERPWD, "clark:kent");
80 ret = curl_easy_perform(curl);
82 curl_easy_cleanup(curl);
88 Returns CURLE_OK on success or
89 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
91 .BR CURLOPT_USERNAME "(3), " CURLOPT_PASSWORD "(3), "
92 .BR CURLOPT_PROXYUSERPWD "(3), "