diff --git a/app/src/main/java/eu/faircode/email/FragmentOAuth.java b/app/src/main/java/eu/faircode/email/FragmentOAuth.java index 30c60d28d0..f3c037f19b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOAuth.java +++ b/app/src/main/java/eu/faircode/email/FragmentOAuth.java @@ -54,6 +54,7 @@ import androidx.preference.PreferenceManager; import net.openid.appauth.AppAuthConfiguration; import net.openid.appauth.AuthState; import net.openid.appauth.AuthorizationException; +import net.openid.appauth.AuthorizationManagementActivity; import net.openid.appauth.AuthorizationRequest; import net.openid.appauth.AuthorizationResponse; import net.openid.appauth.AuthorizationService; @@ -358,14 +359,14 @@ public class FragmentOAuth extends FragmentBase { try { authIntent = authService.getAuthorizationRequestIntent(authRequest); } catch (ActivityNotFoundException ex) { - Log.e(ex); - throw new ActivityNotFoundException("Browser not found"); + Log.w(ex); + authIntent = + AuthorizationManagementActivity.createStartForResultIntent( + context, authRequest, + new Intent(Intent.ACTION_VIEW, authRequest.toUri())); } - if (authIntent.resolveActivity(pm) == null) // action whitelisted - throw new ActivityNotFoundException(authIntent.toString()); - else - startActivityForResult(authIntent, ActivitySetup.REQUEST_OAUTH); + startActivityForResult(authIntent, ActivitySetup.REQUEST_OAUTH); } catch (Throwable ex) { showError(ex); }