If we try to access Gmail with just username and password, it rejects our login and we get a mail "rejected login from less secured app"
Unless we allow less secured apps in gmail settings, it doesn't work.
For 2FA "oauth2", we need clientId, clientSecretKey from google api console. And refresh token for those clientId and secret key from google oauth2 playground.
So we need to find a solution for this. It should work this way: Asking user mail and password and other settings, and workout 2FA behind the scenes or some other way.
Okay, so it works two ways:
If we try to access Gmail with just username and password, it rejects our login and we get a mail "rejected login from less secured app" Unless we allow less secured apps in gmail settings, it doesn't work.
For 2FA "oauth2", we need clientId, clientSecretKey from google api console. And refresh token for those clientId and secret key from google oauth2 playground.
Refer this video for more details: https://www.youtube.com/watch?v=JJ44WA_eV8E
So we need to find a solution for this. It should work this way: Asking user mail and password and other settings, and workout 2FA behind the scenes or some other way.