Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


The XOAUTH2 bearer token.

Component Version macOS Windows Linux Server iOS SDK
CURL 8.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionXOAuth2Bearer"; curl; Value )   More


Parameter Description Example
curl The CURL session handle. $curl
Value The option value.


Returns OK or error.


The XOAUTH2 bearer token.
For open authentication used with web services.
No Bearer prefix please.

If used, please don't call CURL.SetOptionUserName and CURL.SetOptionPassword as that would overwrite the token.

Use e.g. with google mail.

See also XOAUTH2_BEARER option in CURL manual.


Setup oAuth for SMTP with user name, bearer and no password:

Set Variable [ $r ; Value: MBS("SendMail.SetSMTPUserName"; $EmailID; "") ]
Set Variable [ $r ; Value: MBS("SendMail.SetSMTPPassword"; $EmailID; "" // empty ) ]
# ...
Set Variable [ $r ; Value: MBS("CURL.SetOptionXOAuth2Bearer"; $curl; "dXNlcj1zb21...") ]

Setup IMAP for Office 365:

Set Variable [ $r ; Value: MBS("CURL.SetOptionURL"; $curl; "imaps://") ]
Set Variable [ $r ; Value: MBS("CURL.SetOptionXOAuth2Bearer"; $curl; "eyJ0eXAiOi...") ] // your oAuth token
Set Variable [ $r ; Value: MBS("CURL.SetOptionUserName"; $curl; "") ] // no password needed!

See also

Example Databases

Blog Entries

Created 15th April 2018, last changed 13th April 2023

CURL.SetOptionWildCardMatch - CURL.SetProgressEvaluate