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