Lately, email servers on the web have started to move to OAuth 2.0 authentication to increase security. Starting with 4D v18 R6, 4D provides a way to set the OAuth 2.0 authentication mode of a connection. Keep reading for the details!
IMAP, SMTP, and POP3 transporters now natively support OAuth 2.0 authentication. The OAuth 2.0 protocol is used to obtain an access token that allows you access to your emails. To use it, you just need to create your transporter as usual and replace the password attribute with the new accessTokenOAuth2 attribute, then add your token there.
For example, to create an IMAP transporter with OAuth 2.0:
$parameters:=New object
$parameters.authenticationMode:=IMAP authentication OAUTH2
// Token received from the web mail server
$parameters.accessTokenOAuth2:=$token
// e-mail address of the user for whom the token was created
$parameters.user:=$user
$parameters.host:="Outlook.office365.com"
$parameters.port:=995
$imapTransporter:=IMAP New transporter($parameters)
Download the HDI above to see OAuth 2.0 authentication in action by connecting your Gmail account!
And check out the doc center for more details!