pallets-eco/flask-mail

Add support for Oauth

Closed this issue · 2 comments

Add support for Oauth.

As per google:

On May 30, you may lose access to apps that are using less secure sign-in technology.

To help keep your account secure, Google will no longer support the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password. Instead, you’ll need to sign in using [Sign in with Google] or other more secure technologies, like OAuth 2.0.

What do you need to do?
An app or device which uses Simple Mail Transfer Protocol (SMTP) to send emails using your Google Account has less secure access to your Gmail. This might be an older device, like a printer or scanner. To continue using your Google Account with this app or device:

App - Remove your Google Account from the app or device and sign in again using Sign in with Google
Device - Change your device’s settings so you’re using more secure sign-in technology

That's talking about user-facing applications. Flask-Mail is on the server side, there's no way to go through an interactive OAuth flow (and it wouldn't make sense, each user doesn't authenticate with their own account, you need to authenticate with the account your app uses to send mail as).

Gmail still supports traditional SMTP authentication, you need to generate an app password to use instead. https://support.google.com/mail/answer/185833?sjid=9377357504587284656-NC

It looks like this may involve a new type of auth command to the smtp server. Consider reporting this to cpython smtplib first: https://github.com/python/cpython/issues, as it would make more sense for the smtp library to support it, and then us to add a config for it.