See https://en.wikipedia.org/wiki/OAuth (the "Controversy" section is quite interesting)
However, the procedure required to acquire the password token is very complex and varies between the various implementors (Google, Microsoft, Yahoo, etc.). Rather than dealing with OAUTH2, consider using Two Factor Authentication with "app passwords".
OAUTH2 Tutorial
https://www.tutorialspoint.com/oauth2.0/
How OAuth2 works (GMail Example)
For more details, see
If using SMTP, you must enable the OAUTH2 protocol as follows:
Once you have acquired the OAUTH2 access token from your token server, format it with seeMakeXOAuth2() or seeMakeXOAuth2N(), then pass the resultant string as the password.
Yahoo
In order to connect to the Yahoo server, see https://developer.yahoo.com/oauth2/guide/openid_connect/getting_started.html
Once the access token is received from Yahoo, follow the same procedure as above.
HOME PAGE
MARSHALLSOFT is a trademark of MarshallSoft Computing, Inc.