splitbrain / dokuwiki-plugin-smtp

Send DokuWiki mails via a configured SMTP server
https://www.dokuwiki.org/plugin:smtp
12 stars 14 forks source link

OAuth authentication, e.g. for Google Mail #13

Open Paebbels opened 7 years ago

Paebbels commented 7 years ago

Hello,

I have a DokuWiki hostet on a free webspace in the UK and I have a Google account for emails. This secondary Google account is linked to my primary account, from which Google knows, that my phone and all my browser sessions are located in Germany. When I try to send an email via DokuWiki, Google detects a possible dangerous login and alerts my (in the browser, phone, ...). The login and send attempt from the UK is blocked and DokuWiki outputs an error if debugging is enabled.

Google supports OAuth for emails, so I could generate an authentication token for DokuWiki (additionally to the login token to reuse Google logins). Is it possible to extend this plugin to support OAuth in addition to plain authentication over TLS/SSL?

Edit: Links for futher reading on OAuth and Google:

Kind regards Patrick Lehmann

splitbrain commented 7 years ago

This would need to be implemented in https://github.com/txthinking/Mailer which I use in this plugin.

Mailer tries to be a lightweight SMTP implementation without much dependencies. Adding oAuth might add unwanted dependencies and thus might be rejected unless the implementation can be kept simple (eg. not adding a huge third party oauth library).

In any case I recommend opening a feature request at Mailer.

Paebbels commented 7 years ago

Hello,

the linked page to Google's tools is just a demonstration, the OAuth code has circa 20 lines of PHP code. https://github.com/google/gmail-oauth2-tools/blob/master/php/oauth2.php#L47-L70

Do you forward it or should I create a new issue on their repository?

Thanks Patrick Lehmann

splitbrain commented 7 years ago

that example is for imap not SMTP. I am not saying it isn't possible to keep this simple, I am just saying it should.

please open the upstream ticket yourself.

Paebbels commented 7 years ago

Sorry, the PHP example is just for IMAP, the Python example was shown in the docs, which tests SMTP...

OK, thanks. I'll open an issue there.

Paebbels commented 7 years ago

Hello, OAuth is now implemented in txthinking/Mailer.

Mikhael-Danilov commented 2 years ago

Btw, Google disabled password based auth for SMTP.