I am playing around with OpenID Connect and OAuth and I want to support multiple OpenID providers (so not only the ones known by the AccountManager). However, I ran into this issue.

When authenticating against Google as an Installed Application, you pass a callback address, which is pre-defined (by Google) to `http://localhost`. So, I launch the OAuth flow by redirecting to Google's end-point like this:

```
String url = "https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=%2F&redirect_uri=http%3A%2F%2Flocalhost%3A9999&response_type=code&client_id=000000000000000.apps.googleusercontent.com";
Intent i = new Intent (Intent.ACTION_VIEW);
i.setData (Uri.parse (url));
startActivity (i);

```

Note that I pass the redirect\_uri as required (port 9999, which is allowed). I have registered my application to respond to this type of address being loaded as follows:

```
<data android:scheme="http" android:host="localhost" android:port="9999" />

```

However, this causes the system to show the "Complete action with" dialog:

![enter image description here](https://i.stack.imgur.com/y2x7b.png)

So, since there is nothing listening on port 9999 of the phone, if the user chooses the Browser, an error page will be shown by the Browser and the whole authentication flow will be broken.

How can I avoid this?