Hello,
I remember you asking this question a while back as well, and I didn't respond at the time as I didn't really have anything useful to add unfortunately. But since you went to all the trouble of coming back and asking again, I've spent a bit of time on this, and have made a little progress, though I suspect it's not quite going to be the variety of progress you're looking for. Anyway, here's what I've found.
Generally when on a *NIX system, I like to use Alpine as my mail client. I do have a GMail account, though I seldom use it, and have a Pine .pinerc file set up to access my GMail. Or I did - as you describe, that now doesn't work, due to the various little "We'd like you to use our mail client please"-style roadblocks that Google have put in the way.
However, the latest version of Alpine, 2.26, seems to have support for the current GMail login mechanism, albeit in a very kludgey and horrible way. Step by step, here's what I did to get this working:
- I built the latest Alpine from source, grabbing it straight from https://alpineapp.email/.
- I ran
alpine -v
on my existing system to get the configure
string that had been used by Red Hat when they built it (I'm testing on a CentOS 7.x system), and used that same set of options, albeit with a new prefix of /usr/local
so it wouldn't clobber my existing Alpine RPM install.
- I then did a regular
make
/ make install
- I re-ran my new local Alpine binary with my existing GMail-compatible .pinerc file, and it provided me with a URL to copy-and-paste into a Web browser
- I did that, which then took me to Google's account system. I logged in, and was ultimately re-directed to a bogus non-working URL beginning with
http://localhost
. That's fine though, and weirdly is actually what we want.
- I copy-and-pasted that non-functioning localhost URL back into my Alpine terminal window, first pressing "C" to enter the code
- And that was that - I then had access to my GMail Inbox.
It must be said that this is not the only set of hoops I had to jump through. Many months/years previously, I had to go through the trouble of getting OAUTH2 working with Alpine in the first place. That involved setting up a Google developer account, registering my own local install of Alpine as a Google application, and getting a set of keys and credentials that I could copy-and-paste into my Alpine .pinerc file for Alpine to use for authentication. I did all that so long ago that I can't recall the step-by-step sequence there, sorry. I do recall just following the steps I found on the Web for doing this though, so hopefully it won't be too tricky for you to set up.
Anyway, the end result of all this is that you'll be able to run a currently-still-working-until-they-think-of-another-way-to-break-it-again Linux mail client in a terminal window, and said client will beep when a new e-mail comes in.
Not great, I know, but it's the best I currently have to offer in terms of a semi-passable solution. If anyone else has any ideas I'm sure they'll chime in, but to be honest I strongly suspect that most people have just thrown in the towel on this one and are using either the GMail Web page or GMail on their phone and/or tablet to read their Google mail these days, due to how difficult Google are making it to do anything else.
Hope this helps !
EDIT: Just realised you're not actually directly trying to access a GMail account, but rather another OAUTH2-enforced mail system. Given that Alpine does support OAUTH2 login as a mechanism however, I'll leave all of the above intact and as-is, since much of the info there may still be useful to you in any case (or to anyone else who wanders along trying to get a Linux terminal mail client working with GMail).