Android App triggers Open With after authentication with Google

I’m using Auth0 for login with database and social. Normal database works fine.

I have setup a new client in Auth0 of type ‘Native app’ and the callback URL I’m using is:

https://spnkdev.eu.auth0.com/android/packagename/callback

I’ve tested this in my app and the custom login demo given by Auth0. This is the flow:

  1. Click login with google button
  2. Get asked to choose which app/browser to open with and I choose chrome
  3. Chrome opens and i fill out the data and after that it starts redirecting
  4. While loading it asks me what to open with again, giving the same options + option to open with my app.

If I choose chrome again i get a new tab which says CANNOT GET {callback url}.

If I choose my app it goes back to the app but does nothing and the chrome tab above also appears but goes to the background.

From the Auth0 Dashboard logs I can see the logins are done successfully and the login seems to work fine on the browser but not on the app. It seems there are some problems with the redirect. I’ve also tested with emulators and physical devices and the issue remains.

The code used is the same available on their custom login demos. I’ve tried with default auth0 credentials and my credentials for google.

For what is worth in the android studio monitor when I click the login button I also get this info:

 V/CallbackHelper: The Callback URI is: https://spnkdev.eu.auth0.com/android/packagename/callback

As of Android 6.0 (API level 23) the application can designate itself as the default handler of a given type of link. In addition to that the application can also request automatic verification that it’s indeed associated with the link in question which should then, by default, bypass the user prompt at step 4. and automatically open the callback link through your application.

In order to request automatic verification you need to place the android:autoVerify="true" attribute in the intent filter associated with the given link. In addition, ** your client application in the Auth0 Dashboard needs to be correctly configured to include the Android related settings that enable the verification process to succeed**. In the client advanced settings, select the Mobile section and provide the Android app package name and key hashes. See (Android Development Keystores and Key Hashes) for reference documentation on how to accomplish this.

Having met the above requirements of enabling auto verification at the intent filter level and configuring the client application correctly then on supported Android versions the callback link should open with your application automatically instead of prompting the user.

The issue is fixed now. It was due to the misplace of :

android:launchMode="singleTask"

Was in the application part instead of the activity. Thanks for your help!