From e52daaf89565977d339d43e462f83aa7f72ee1ae Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 25 Jan 2024 14:37:07 +0100 Subject: [PATCH] Add token expiration time to auth fail exceptions --- app/src/main/java/eu/faircode/email/EmailService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 99c72c3fca..e1ebff6939 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -526,6 +526,12 @@ public class EmailService implements AutoCloseable { msg != null && msg.endsWith("Invalid credentials (Failure)")) msg += "\n" + context.getString(R.string.title_service_token); + if (auth == AUTH_TYPE_OAUTH) { + Long expiration = authenticator.getAccessTokenExpirationTime(); + if (expiration != null && expiration < new Date().getTime()) + msg = "Access token expired at " + new Date(expiration) + "\n" + msg; + } + Throwable c = ex1; while (c != null) { String m = c.getMessage();