From norbert at preining.info Tue Oct 8 06:02:04 2019 From: norbert at preining.info (Norbert Preining) Date: Tue, 8 Oct 2019 14:02:04 +0900 Subject: gmail access problem (OAuth2, 2F) Message-ID: <20191008050204.5vgwj7dncegw6g5z@bulldog.preining.info> Dear all, (please cc) my company email account was moved to GSuite, and now I am stumbling to get OfflineImap to work with this monster. In addition, we are forced to use 2 Factor authentication. What I did succeed is set up Thunderbird to access my account with the usual settings: - enter email and password - enter Google imap/smtp server, select OAuth2 - click Ok, the Thunderbird window shown asks me to log in, and authenticate with the second factor - Select trust this device etc So now Thunderbird is working, but I really want offlineimap (as hard core mutt user). What puzzles me is where I can use the password that was given to me? I have created a subproject on our company space, got client id and secret, generated an oauth refresh token etc using https://github.com/google/gmail-oauth2-tools . My current configuration contains [Repository remote-xxx] type = Gmail oauth2_client_id = xxx oauth2_client_secret = xxx oauth2_request_url = https://accounts.google.com/o/oauth2/token oauth2_refresh_token = xxx sslcacertfile = /etc/ssl/certs/ca-certificates.crt (and some folderfilter). Running offlineimap with -d imap I see that [imap]: Attempting XOAUTH2 authentication [imap]: xoauth2handler: url "https://accounts.google.com/o/oauth2/token" [imap]: xoauth2handler: params ... [imap]: xoauth2handler: response "{u'access_token': XXX [imap]: xoauth2handler: access_token XXX [imap]: xoauth2handler: returning "user=Noneauth=Bearer XXX [imap]: xoauth2handler: access_token XXX imap]: xoauth2handler: returning "user=Noneauth=Bearer XXX XOAUTH2 authentication failed: [AUTHENTICATIONFAILED] Invalid credentials (Failure) Did anyone get this setup to work? I am wondering what Thunderbird is doing that offlineimap + oauth tool is not doing. And, where I would fill in the password provided ... Thanks Norbert -- PREINING Norbert http://www.preining.info Accelia Inc. + IFMGA ProGuide + TU Wien + JAIST + TeX Live + Debian Dev GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13