From 4c4c7d72cc781188431e9a678417d4f0a8de2ed3 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 24 Mar 2021 20:15:49 +0100 Subject: [PATCH] Skip LOGIN after XOAUTH2 --- app/src/main/java/com/sun/mail/imap/IMAPStore.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/sun/mail/imap/IMAPStore.java b/app/src/main/java/com/sun/mail/imap/IMAPStore.java index 3527ce1598..c22838cdf9 100644 --- a/app/src/main/java/com/sun/mail/imap/IMAPStore.java +++ b/app/src/main/java/com/sun/mail/imap/IMAPStore.java @@ -858,6 +858,7 @@ public class IMAPStore extends Store * the mechanism and we have an authenticator for the mechanism, * and it hasn't been disabled, use it. */ + boolean xoauth2 = false; ProtocolException pex = null; StringTokenizer st = new StringTokenizer(mechs); while (st.hasMoreTokens()) { @@ -902,6 +903,7 @@ public class IMAPStore extends Store return; } else if (m.equals("XOAUTH2")) { + xoauth2 = true; p.authoauth2(user, password); return; } @@ -915,7 +917,7 @@ public class IMAPStore extends Store } } - if (!p.hasCapability("LOGINDISABLED")) + if (!p.hasCapability("LOGINDISABLED") && !xoauth2) try { eu.faircode.email.Log.i("Trying LOGIN"); p.login(user, password);