[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Alpine/Gmail/Imap expert needed.



The following link is unlikely helpful to the topic starter, so I decided to postpone this message. It may be informative for other alpine (or mutt) users however. There is a way to authenticate to gmail or a similar service without an application password. It is supported by Alpine. It requires opening a link in a browser and copy-paste of the obtained token back.

https://alpineapp.email/alpine/alpine-info/misc/xoauth2.html
"Authenticating using XOAUTH2 in IMAP and SMTP"

Perhaps the procedure might be made a bit more convenient with a dedicated web site or a browser extension, but a couple of obstacles may arise: user trust and terms of service limiting redirection URI.

On 27/11/2023 16:13, Gareth Evans wrote:
Google allows you to use "backup codes" as a two-factor authentication
method, which avoids the need for a phone or app, though as far as I
recall, you need to receive a text message or use an authenticator app
at least once, to turn on two-factor authentication in the first place.
You only get so many backup codes and they only work once each.  After
that, you can still sign in to generate more, but only through the web,
so would need to be able to receive a text message or use an
authenticator app if/when you run out of codes.
[...]
Screenshot or write down and/or copy to clipboard the code shown

I am unsure if the hassle with recovery codes is really necessary. Having a secret obtained with authentication application flow, it is possible to generate time-based codes. TOTP is documented and has enough implementations. E.g. KeePassXC password manager supports it. Most of services allows to get the secret as text, it can be obtained from the link encoded as a QR code.

In my notes I have the following snippet for python:

import onetimepass as otp
my_token = otp.get_totp(my_secret)

Certainly doing it in a secure way requires more efforts, but a 2FA helper may be adjusted for special needs.


Reply to: