OAuth ask account precedence

pull/172/head
M66B 5 years ago
parent 805bcf7b04
commit 5fc5f23bc7

@ -376,7 +376,10 @@ public class FragmentOAuth extends FragmentBase {
String primaryEmail = null;
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
URL url = new URL("https://www.googleapis.com/gmail/v1/users/me/settings/sendAs");
Log.i("Fetching " + url);
@ -414,7 +417,6 @@ public class FragmentOAuth extends FragmentBase {
}
}
}
} else if ("outlook".equals(id)) {
// 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");
@ -451,9 +453,6 @@ public class FragmentOAuth extends FragmentBase {
identities.add(new Pair<>(email, displayName));
}
}
} else if (askAccount) {
primaryEmail = address;
identities.add(new Pair<>(address, personal));
} else
throw new IllegalArgumentException("Unknown provider=" + id);

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

Loading…
Cancel
Save