OAuth ask account precedence

This commit is contained in:
M66B 2020-01-24 11:57:11 +01:00
parent 805bcf7b04
commit 5fc5f23bc7
2 changed files with 5 additions and 5 deletions

View File

@ -376,7 +376,10 @@ public class FragmentOAuth extends FragmentBase {
String primaryEmail = null; String primaryEmail = null;
List<Pair<String, String>> identities = new ArrayList<>(); List<Pair<String, String>> identities = new ArrayList<>();
if ("gmail".equals(id)) { if (askAccount) {
primaryEmail = address;
identities.add(new Pair<>(address, personal));
} else if ("gmail".equals(id)) {
// https://developers.google.com/gmail/api/v1/reference/users/getProfile // https://developers.google.com/gmail/api/v1/reference/users/getProfile
URL url = new URL("https://www.googleapis.com/gmail/v1/users/me/settings/sendAs"); URL url = new URL("https://www.googleapis.com/gmail/v1/users/me/settings/sendAs");
Log.i("Fetching " + url); Log.i("Fetching " + url);
@ -414,7 +417,6 @@ public class FragmentOAuth extends FragmentBase {
} }
} }
} }
} else if ("outlook".equals(id)) { } else if ("outlook".equals(id)) {
// https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http#http-request // https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http#http-request
URL url = new URL("https://graph.microsoft.com/v1.0/me?$select=displayName,otherMails"); URL url = new URL("https://graph.microsoft.com/v1.0/me?$select=displayName,otherMails");
@ -451,9 +453,6 @@ public class FragmentOAuth extends FragmentBase {
identities.add(new Pair<>(email, displayName)); identities.add(new Pair<>(email, displayName));
} }
} }
} else if (askAccount) {
primaryEmail = address;
identities.add(new Pair<>(address, personal));
} else } else
throw new IllegalArgumentException("Unknown provider=" + id); throw new IllegalArgumentException("Unknown provider=" + id);

View File

@ -34,6 +34,7 @@
port="587" port="587"
starttls="true" /> starttls="true" />
<oauth <oauth
askAccount="true"
authorizationEndpoint="https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize" authorizationEndpoint="https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize"
clientId="3514cf2c-e7a3-45a2-80d4-6a3c3498eca0" clientId="3514cf2c-e7a3-45a2-80d4-6a3c3498eca0"
clientSecret="MZaRn@liyA0T98GwdRDK:m-cSWrUgA9:" clientSecret="MZaRn@liyA0T98GwdRDK:m-cSWrUgA9:"