Search code examples
javaandroidgmail

Android reading emails without enabling less secure app


So i came across this Less secure apps & your Google Account link, And it states that after the 30th of may this year, Enabling 'less secure apps' option will no longer be available.

enter image description here

I was wondering if there will be any alternative? I need to be able to read emails and download attachments through my application without the user having to do so himself, So the Gmail API is no good as far as i could see.

I also couldn't find any other option to access a gmail inbox without enabling this option... Ty for your time.


Solution

  • The whole point of this is that you should not be using someone's login and password to access gmail. You could try using an apps password but it is unlcear if this will work or not in the long run. Google has been very vague about that.

    You should be authorizing the user either using Xoauth2 for the smtp server or by using the Gmail api and authorizing the user.

    With oauth you can request a refresh token and then you will only need to request the users permission once after that you can use your refresh token to request a new access token.