From 3b2805715fabdf28eb6159aaea9fcc9c9cac6ec1 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 29 Nov 2021 17:11:03 +0100 Subject: [PATCH] Improved error message --- FAQ.md | 2 +- .../java/eu/faircode/email/ServiceAuthenticator.java | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/FAQ.md b/FAQ.md index 9737e8d018..676ade11e2 100644 --- a/FAQ.md +++ b/FAQ.md @@ -576,7 +576,7 @@ After enabling two factor authentication there will be this error message: *[ALERT] Application-specific password required: https://support.google.com/mail/accounts/answer/185833 (Failure)* -The error message "*Authentication failed - Invalid credentials*" means that the Android account manager was not able to refresh the access token. +The error message "*Authentication failed - Invalid credentials*" or *Token refresh required* means that the Android account manager was not able to refresh the access token. A common cause for this problem is using a VPN, a firewall app or an ad blocker which blocks internet access for the Android account manager. You can workaround this issue by using an app password. Please [see here](#user-content-howto) about how you can delete the account configured with the quick setup wizard. diff --git a/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java b/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java index 494397499d..fcf41dc332 100644 --- a/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java +++ b/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java @@ -136,15 +136,8 @@ public class ServiceAuthenticator extends Authenticator { Log.e(ex); } - if (expiration != null && expiration - keep_alive < new Date().getTime()) { - try { - refreshToken(true); - } catch (Throwable ex) { - Log.w(ex); - } - - throw new IllegalStateException("Token refreshed"); - } + if (expiration != null && expiration - keep_alive < new Date().getTime()) + throw new IllegalStateException("Token refresh required. Is there a VPN based app running?"); } interface IAuthenticated {