smtpauthtype has no XOAUTH2 option

smtpauthtype has no XOAUTH2 option

by David Topps -
Number of replies: 5

Our University uses Microsoft services for outgoing mail from servers. Authentication between our moodle site and the campus SMTP service requires OAuth2 authentication. 

I have successfully configured the key/secret handshake and the service endpoints. When I 'connect to system account' using our service account, which is what I am supposed to use as the outgoing user, the OAuth2 services happily connect and authenticate with MS Azure AD services. So all seems good there. Green tick marks etc. 

But when I go to configure Outgoing Mail Services, there is no option to choose XOAUTH2 as the smtpauthtype. The four options that I have are LOGIN | PLAIN | NTLM | CRAM-MD5

The rest of the outgoing mail config looks correct and the same as several help pages I have consulted. Port 587 etc. 

I tried enabling the OAuth2 plugin (which seems mostly to relate to OAuth2 authentication into our Moodle site (which we don't really need) but this has not helped. 

I also manually changed the strings in authtypeoptions in the settings.php file for our Moodle site. That does allow me to pick XOAUTH2 as an option, it seems that we need more than just that string to be correct. 

I have looked quite extensively for a fix. All the relevant help pages seem to assume that I can pick the XOAUTH2 option as my smtpauthtype. 

So what am I missing? 

Average of ratings: -
In reply to David Topps

Re: smtpauthtype has no XOAUTH2 option

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi David,
what is your Moodle version?

XOAUTH2 support has been added in 4.1 via MDL-61921.

HTH,
Matteo

Average of ratings: Useful (1)
In reply to Matteo Scaramuccia

Re: smtpauthtype has no XOAUTH2 option

by David Topps -
Ah, maybe that is the problem. v3.10 is what we are using.

Looking at Moodle docs for 3.9 , it says that OAuth is supported. But it must not be to a sufficient degree.
Will upgrade and see if that fixes things. Sounds like it will. Thank you
In reply to David Topps

Re: smtpauthtype has no XOAUTH2 option

by Brett Dalton -
Picture of Moodle HQ Picture of Particularly helpful Moodlers
OAuth for user authentication is not the same as XOAUTH for mail authentication, they are related but different. Given this was a new feature and not a bug it will not have been backported to 3.10 If upgrading isn't an option you could look to backport the change for your installation, its fairly selfcontained but may not be trivial.
Average of ratings: Useful (1)
In reply to David Topps

Re: smtpauthtype has no XOAUTH2 option

by Gemma Lesterhuis -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
HI David
I wonder if you got it working after the upgrade. 

I am struggling with the right setup and unsure if it is a Moodle issue or an Azure configuration issue. 

I am going through the Microsoft Forums, and tried to follow the things they say . Ended up with adding the mail.send and smtps.sendAsApp premissions but still get an authentication error. Now wondering if I should change the scopes and/or endpoints on the Moodle configuratiion as well. 

In short struggling and kind of hoping you got it working and would be keen in sharing your settings with me. 

Looking forward to your reply. 

Gemma
In reply to David Topps

Re: smtpauthtype has no XOAUTH2 option

by Jerry Lau -
David .. we are the same, we want to use MS Exchange Online Protection rather than smtp 


Is yours the same? Did you get it to work?


We are using moodle 4.1.x


Thanks