Search code examples
javaemailgmailjakarta-mail

Sign into Gmail without less secure apps on javamain


I'm trying to make a kind of email client program. I'm using transport.connect to attempt to connect to the users Gmail account with their username and password, but the application will return this if they don't have the setting to enable less secure access and I don't want to have to have that because not every user will know. I also don't need to get or send mail, I just need to get a valid sign in.


Solution

  • "Less secure apps" in that setting specifically means username and password.

    You need to use OAuth, so that your code never sees the user's password.