GNURLOPT_XOAUTH2_BEARER(3)
π GNURLOPT_XOAUTH2_BEARER(3) β the curl_easy_setopt girlies' era
okay so bestie, this page lives in the curl_easy_setopt options section of the gnurl manual, and it's genuinely one of the more iconic ones. buckle up π
β¨ NAME β¨
CURLOPT_XOAUTH2_BEARER β specify OAuth 2.0 access token π¦
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_XOAUTH2_BEARER, char *token);
β¨ DESCRIPTION β¨
so you pass a char * as the parameter, and that pointer should point at a null-terminated OAuth 2.0 Bearer Access Token. literally just hand over the token and let it vibe. it's for use with HTTP, IMAP, POP3 and SMTP servers that support the OAuth 2.0 Authorization Framework β¨
π«Ά note note note: for IMAP, POP3 and SMTP, the user name used to generate the Bearer Token should be supplied via the CURLOPT_USERNAME(3) option. like, that's the pairing, iykyk π
and the best part? the application does not have to keep the string around after setting this option. you can let it go, no strings attached, main character energy π
β¨ DEFAULT β¨
NULL π (as in, nothing, nada, no token yet)
β¨ PROTOCOLS β¨
IMAP, POP3 and SMTP πΈ
β¨ EXAMPLE β¨
ok so here's the whole little situation, copy it exactly bestie:
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "pop3://example.com/");
curl_easy_setopt(curl, CURLOPT_XOAUTH2_BEARER, "1ab9cb22ba269a7");
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
ate, no crumbs π₯
β¨ AVAILABILITY β¨
Added in 7.33.0 β (so if you're on something ancient, that's a you problem, upgrade bb)
β¨ RETURN VALUE β¨
returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space π (heap space said "not today")
β¨ SEE ALSO β¨
and that's the page, bestie π§π this one shipped as part of libcurl 7.37.0, dated 19 Jun 2014, and it's filed under GNURLOPT_XOAUTH2_BEARER(3) β slay, go get that token ππ
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms