1CURLOPT_XOAUTH2_BEARER(3) curl_easy_setopt options CURLOPT_XOAUTH2_BEARER(3)
2
3
4
6 CURLOPT_XOAUTH2_BEARER - OAuth 2.0 access token
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XOAUTH2_BEARER, char *token);
12
14 Pass a char * as parameter, which should point to the null-terminated
15 OAuth 2.0 Bearer Access Token for use with HTTP, IMAP, LDAP, POP3 and
16 SMTP servers that support the OAuth 2.0 Authorization Framework.
17
18 Note: For IMAP, LDAP, POP3 and SMTP, the user name used to generate the
19 Bearer Token should be supplied via the CURLOPT_USERNAME(3) option.
20
21 The application does not have to keep the string around after setting
22 this option.
23
25 NULL
26
28 HTTP, IMAP, LDAP, POP3 and SMTP
29
31 CURL *curl = curl_easy_init();
32 if(curl) {
33 curl_easy_setopt(curl, CURLOPT_URL, "pop3://example.com/");
34 curl_easy_setopt(curl, CURLOPT_XOAUTH2_BEARER, "1ab9cb22ba269a7");
35 ret = curl_easy_perform(curl);
36 curl_easy_cleanup(curl);
37 }
38
40 Added in 7.33.0. Support for OpenLDAP added in 7.82.0.
41
43 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
44 not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
45
47 CURLOPT_MAIL_AUTH(3), CURLOPT_USERNAME(3),
48
49
50
51libcurl 8.0.1 January 02, 2023 CURLOPT_XOAUTH2_BEARER(3)