| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
CURL.SetOptionXOAuth2Bearer
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
Parameters
| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | The option value. |
Result
Returns OK or error.
Description
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.
Examples
Setup oAuth for SMTP with user name, bearer and no password:
Set Variable [ $r ; Value: MBS("SendMail.SetSMTPUserName"; $EmailID; "test@gmail.com") ]
Set Variable [ $r ; Value: MBS("SendMail.SetSMTPPassword"; $EmailID; "" // empty ) ]
# ...
Set Variable [ $r ; Value: MBS("CURL.SetOptionXOAuth2Bearer"; $curl; "dXNlcj1zb21...") ]
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://outlook.office365.com/INBOX") ]
# your oAuth token
Set Variable [ $r ; Value: MBS("CURL.SetOptionXOAuth2Bearer"; $curl; "eyJ0eXAiOi...") ]
# no password needed! Just username:
Set Variable [ $r ; Value: MBS("CURL.SetOptionUserName"; $curl; "test@outlook.com") ]
# your oAuth token
Set Variable [ $r ; Value: MBS("CURL.SetOptionXOAuth2Bearer"; $curl; "eyJ0eXAiOi...") ]
# no password needed! Just username:
Set Variable [ $r ; Value: MBS("CURL.SetOptionUserName"; $curl; "test@outlook.com") ]
See also
- CURL.SetOptionAutoReferer
- CURL.SetOptionPassword
- CURL.SetOptionUploadFlags
- CURL.SetOptionURL
- CURL.SetOptionUserName
- SendMail.SetSMTPPassword
- SendMail.SetSMTPUserName
Example Databases
- CURL/Email/GMail oAuth SMTP
- CURL/Email/IMAP Email List
- CURL/Email/IMAP Email Upload
- CURL/Email/IMAP Email
- CURL/Email/List IMAP folders
- CURL/Email/Office 365 oAuth SMTP
- CURL/WebServices/ebay webservice/ebay Webservice
Blog Entries
- IMAP Upload Flags
- Using Gmail with oAuth2 for SMTP with MBS Plugin
- More follow up on oAuth for Office 365
- SMTP with OAuth for Office 365 in FileMaker
- GMail for emails with MBS Plugin
Created 15th April 2018, last changed 7th September 2025