Workaround OAuth browser missing

pull/199/head
M66B 4 years ago
parent 3b9e74b79c
commit e7b7228494

@ -54,6 +54,7 @@ import androidx.preference.PreferenceManager;
import net.openid.appauth.AppAuthConfiguration; import net.openid.appauth.AppAuthConfiguration;
import net.openid.appauth.AuthState; import net.openid.appauth.AuthState;
import net.openid.appauth.AuthorizationException; import net.openid.appauth.AuthorizationException;
import net.openid.appauth.AuthorizationManagementActivity;
import net.openid.appauth.AuthorizationRequest; import net.openid.appauth.AuthorizationRequest;
import net.openid.appauth.AuthorizationResponse; import net.openid.appauth.AuthorizationResponse;
import net.openid.appauth.AuthorizationService; import net.openid.appauth.AuthorizationService;
@ -358,13 +359,13 @@ public class FragmentOAuth extends FragmentBase {
try { try {
authIntent = authService.getAuthorizationRequestIntent(authRequest); authIntent = authService.getAuthorizationRequestIntent(authRequest);
} catch (ActivityNotFoundException ex) { } catch (ActivityNotFoundException ex) {
Log.e(ex); Log.w(ex);
throw new ActivityNotFoundException("Browser not found"); 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) { } catch (Throwable ex) {
showError(ex); showError(ex);

Loading…
Cancel
Save