Disabled Gmail web OAuth

This commit is contained in:
M66B 2022-07-20 13:24:40 +02:00
parent 566bfbf447
commit ada1b48166
3 changed files with 7 additions and 3 deletions

View File

@ -47,7 +47,6 @@ import android.text.style.RelativeSizeSpan;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@ -278,9 +277,9 @@ public class FragmentSetup extends FragmentBase {
Resources res = context.getResources();
String pkg = context.getPackageName();
List<EmailProvider> providers = EmailProvider.loadProfiles(context);
boolean web = false;
List<EmailProvider> providers = EmailProvider.loadProfiles(context);
for (EmailProvider provider : providers)
if ("gmail".equals(provider.id) &&
provider.oauth != null &&
@ -291,6 +290,7 @@ public class FragmentSetup extends FragmentBase {
int order = 1;
// Gmail / account manager
String gmail = getString(web ? R.string.title_setup_android : R.string.title_setup_oauth,
getString(R.string.title_setup_gmail));
MenuItem item = menu.add(Menu.FIRST, R.string.title_setup_gmail, order++, gmail);
@ -298,6 +298,7 @@ public class FragmentSetup extends FragmentBase {
if (resid != 0)
item.setIcon(resid);
// OAuth
for (EmailProvider provider : providers)
if (provider.oauth != null &&
(provider.oauth.enabled || BuildConfig.DEBUG) &&

View File

@ -152,6 +152,9 @@ public class ServiceAuthenticator extends Authenticator {
private static void OAuthRefresh(Context context, String id, AuthState authState, boolean expire, long keep_alive)
throws MessagingException {
try {
if ("gmail".equals(id) && !BuildConfig.DEBUG)
return;
long now = new Date().getTime();
Long expiration = authState.getAccessTokenExpirationTime();
if (expiration != null && expiration - keep_alive < now) {

View File

@ -24,7 +24,7 @@
askAccount="true"
authorizationEndpoint="https://accounts.google.com/o/oauth2/auth"
clientId="803253368361-11ias0ee6bqhvdi4f21fs1lh7fsb0il2.apps.googleusercontent.com"
enabled="true"
enabled="false"
privacy="https://policies.google.com/privacy"
prompt="consent"
redirectUri="eu.faircode.email:/"