CURLOPT_XOAUTH2_BEARER.3 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. .\" generated by cd2nroff 0.1 from CURLOPT_XOAUTH2_BEARER.md
  2. .TH CURLOPT_XOAUTH2_BEARER 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_XOAUTH2_BEARER \- OAuth 2.0 access token
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XOAUTH2_BEARER, char *token);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a char pointer as parameter, which should point to the null\-terminated
  12. OAuth 2.0 Bearer Access Token for use with HTTP, IMAP, LDAP, POP3 and SMTP
  13. servers that support the OAuth 2.0 Authorization Framework.
  14. Note: For IMAP, LDAP, POP3 and SMTP, the username used to generate the Bearer
  15. Token should be supplied via the \fICURLOPT_USERNAME(3)\fP option.
  16. The application does not have to keep the string around after setting this
  17. option.
  18. .SH DEFAULT
  19. NULL
  20. .SH PROTOCOLS
  21. This functionality affects http, imap, ldap, pop3 and smtp
  22. .SH EXAMPLE
  23. .nf
  24. int main(void)
  25. {
  26. CURL *curl = curl_easy_init();
  27. if(curl) {
  28. CURLcode res;
  29. curl_easy_setopt(curl, CURLOPT_URL, "pop3://example.com/");
  30. curl_easy_setopt(curl, CURLOPT_XOAUTH2_BEARER, "1ab9cb22ba269a7");
  31. res = curl_easy_perform(curl);
  32. curl_easy_cleanup(curl);
  33. }
  34. }
  35. .fi
  36. .SH HISTORY
  37. Support for OpenLDAP added in 7.82.0.
  38. .SH AVAILABILITY
  39. Added in curl 7.33.0
  40. .SH RETURN VALUE
  41. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  42. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  43. .SH SEE ALSO
  44. .BR CURLOPT_MAIL_AUTH (3),
  45. .BR CURLOPT_USERNAME (3)