smtp-mail icon indicating copy to clipboard operation
smtp-mail copied to clipboard

Support for OAuth authentication

Open robstewart57 opened this issue 4 years ago • 2 comments

This library supports PLAIN, LOGIN and CRAM_MD5 authentication mechanisms.

This issue is a feature request for OAuth2 based authentication for sending emails with this library, with a XOAUTH2 constructor for AuthType and supporting functions in Network/Mail/SMTP.hs.

Such that the SMTP client transmits this to the SMTP server:

AUTH XOAUTH2 <oauth token>

rather than providing a username and password as with LOGIN. Instead, a username and OAuth token would be provided.

It might be that this library would need to encode this information in SASL XOAUTH2 format.

robstewart57 avatar Oct 06 '21 12:10 robstewart57

I don't have access to Office365 nor any mail server using SASL XOAUTH2.

How could I test this against a real server after implementation? Are there freely available mail services providing this OAuth2 authentication?

typetetris avatar Oct 06 '21 12:10 typetetris

Hi @typetetris ,

I've opened a pull request that implements OAuth authentication for this library.

PR: https://github.com/jhickner/smtp-mail/pull/38

robstewart57 avatar Jan 18 '23 21:01 robstewart57