CURLOPT_SASL_AUTHZID(3)
β¨ CURLOPT_SASL_AUTHZID π
okay bestie, so this one is a libcurl manpage β it's CURLOPT_SASL_AUTHZID(3) from the Library Functions Manual, and it's literally about telling the server "hey, I wanna act as this identity" π
πΈ NAME πΈ
CURLOPT_SASL_AUTHZID β the authorization identity, aka the identity you wanna act as π
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SASL_AUTHZID, char *authzid);
π DESCRIPTION π
So you pass a char pointer as the parameter, and it should point to the null-terminated authorization identity (authzid) for the transfer. It's only applicable to the PLAIN SASL authentication mechanism, where it's optional β like, cute but not mandatory, iykyk β¨
When you don't specify it, only the authentication identity (authcid) β the one specified by the username β gets sent to the server, along with the password. The server then derives an authzid from the authcid when it's not provided, and uses that internally. no cap, it just figures it out itself π§
When the authzid is specified β and the use of it is server dependent, lowkey important β it can be used to access another user's inbox that the user has been granted access to, or a shared mailbox, for example. it's giving "let me peek in the group mailbox" energy π
The application does not have to keep the string around after setting this option. so you can free it, bestie, it's fine π«Ά
Using this option multiple times makes the last set string override the previous ones. And set it to NULL to disable its use again β poof, gone π
β DEFAULT β
blank
π PROTOCOLS π
This functionality affects imap only. like, literally only imap, don't try it elsewhere π
π₯ EXAMPLE π₯
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "imap://example.com/");
curl_easy_setopt(curl, CURLOPT_USERNAME, "Kurt");
curl_easy_setopt(curl, CURLOPT_PASSWORD, "xipj3plmq");
curl_easy_setopt(curl, CURLOPT_SASL_AUTHZID, "Ursel");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
Kurt's logging in, but acting as Ursel β main character behavior honestly πβ¨
π AVAILABILITY π
Added in curl 7.66.0 β so if you're on something ancient, that's why it's not working, ngl π¦
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK β slay π
β and non-zero means an error occurred. see libcurl-errors(3) for the full rundown, bestie.
π SEE ALSO π
go read those too, they're the whole friend group π«Ά
heads up: this option isPLAIN-mechanism only andimaponly, and the actual meaning of theauthzidis server dependent β so don't assume, k? π
later bestie π β this page came from the libcurl manual, dated 2026-10-12, page CURLOPT_SASL_AUTHZID(3). stay iconic β¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms