From e325409c2605512be1b8f360baff15ced1e31497 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 20 Jul 2022 13:09:19 +0200 Subject: [PATCH] Limit requiring token refresh --- app/src/main/java/eu/faircode/email/ServiceAuthenticator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java b/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java index b655f1519e..569743b212 100644 --- a/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java +++ b/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java @@ -56,7 +56,7 @@ public class ServiceAuthenticator extends Authenticator { static final int AUTH_TYPE_GMAIL = 2; static final int AUTH_TYPE_OAUTH = 3; - static final long MIN_EXPIRE_INTERVAL = 15 * 60 * 1000L; + static final long MIN_EXPIRE_INTERVAL = 12 * 60 * 1000L; ServiceAuthenticator( Context context, @@ -140,7 +140,7 @@ public class ServiceAuthenticator extends Authenticator { Log.e(ex); } - long slack = Math.min(keep_alive, 30 * 60 * 1000L); + long slack = Math.max(keep_alive, MIN_EXPIRE_INTERVAL); if (expiration != null && expiration - slack < new Date().getTime()) throw new IllegalStateException(Log.TOKEN_REFRESH_REQUIRED); }