From 8684ac8c5f84dfb3807a0a146b2402d92747eda3 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 30 Jun 2020 21:33:53 +0200 Subject: [PATCH] Log OAuth token payload --- .../main/java/eu/faircode/email/FragmentOAuth.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentOAuth.java b/app/src/main/java/eu/faircode/email/FragmentOAuth.java index 6a2ce57ad5..d91829edaf 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOAuth.java +++ b/app/src/main/java/eu/faircode/email/FragmentOAuth.java @@ -387,6 +387,17 @@ public class FragmentOAuth extends FragmentBase { EmailProvider provider = EmailProvider.getProvider(context, id); String aprotocol = (provider.imap.starttls ? "imap" : "imaps"); + if (accessToken != null) { + String[] segments = accessToken.split("\\."); + if (segments.length > 1) + try { + String payload = new String(Base64.decode(segments[1], Base64.DEFAULT)); + EntityLog.log(context, "token payload=" + payload); + } catch (Throwable ex) { + Log.w(ex); + } + } + if (jwt != null) { // https://docs.microsoft.com/en-us/azure/active-directory/develop/id-tokens String[] segments = jwt.split("\\.");