react-native-auth0 icon indicating copy to clipboard operation
react-native-auth0 copied to clipboard

Show duplicate app when with google account by auth0

Open lehuydev2203 opened this issue 3 years ago • 11 comments

Hi, I use react-native-auth0 version 2.13.3. When I log in with a google account, after I choose an account, have a popup showing 'open with ... ' with 2 applications but only the app can log in, remaining to fail.

photo_2022-10-17_16-55-17

lehuydev2203 avatar Oct 17 '22 09:10 lehuydev2203

Hi, can you run this command and see what are all the intent receivers you have for your package name - adb shell dumpsys package r. They can be in different locations so it would be great to comb through them or grep them

poovamraj avatar Oct 17 '22 10:10 poovamraj

I can't run login google on adb and my stuck by a real device

lehuydev2203 avatar Oct 18 '22 02:10 lehuydev2203

https://github.com/auth0/react-native-auth0/pull/533#issuecomment-1281969768

mailaneel avatar Oct 18 '22 08:10 mailaneel

@mailaneel Can you verify the above command doesn't generate 2 different intent receivers for your application id.

Can you also verify that the changes are the ones that are available in the app? Yarn has complicated cache management and wouldn't install the new package if the version number is same. I'd recommend to check if node_modules have the diff reflected

poovamraj avatar Oct 18 '22 08:10 poovamraj

@poovamraj

  1. It does generate 2 intent receivers one for RedirectActivity and on for MainActivity
  2. Yes I have verified node_modules to see the changes are reflected from your commit

I see below

        <activity
            android:name="com.auth0.android.provider.RedirectActivity"
            tools:node="remove"/>

        <activity
            android:name="com.auth0.android.provider.AuthenticationActivity"
            tools:node="remove"/>

auth0 intent filter's looks like this

        <activity
            android:name="com.auth0.react.RedirectActivity"
            android:exported="true">
            <intent-filter android:autoVerify="true"
                tools:targetApi="m">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                 <data
                    android:host="${auth0Domain}"
                    android:pathPrefix="/android/${applicationId}/callback"
                    android:scheme="${auth0Scheme}" />
            </intent-filter>
        </activity>

our one looks like this

      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="${applicationId}"/>
      </intent-filter>

Both are using same scheme and both matches one with prefix filter and one without prefix filter so seeing prompt

mailaneel avatar Oct 18 '22 08:10 mailaneel

Before adding your PR change, I was seeing 3, one of them com.auth0.android.provider.RedirectActivity

Screen Shot 2022-10-18 at 7 51 34 pm

mailaneel avatar Oct 18 '22 08:10 mailaneel

Yep, that seems right, with the PR change there should only be 2. One is the launcher intent receiver and the other one is for our callback

So the issue is being reproduced in this scenario as well? That should be highly unlikely since we have only 1 intent receiver for URLs

poovamraj avatar Oct 18 '22 09:10 poovamraj

yes its is reproducible unfortunately

mailaneel avatar Oct 18 '22 09:10 mailaneel

Ah okay, I didn'tt realize you had a intent receiver as well. My bad. Great the issue is not occuring now.

poovamraj avatar Oct 18 '22 09:10 poovamraj

sorry posted early, its still happening any help would be appreciated

mailaneel avatar Oct 18 '22 09:10 mailaneel

Hi @mailaneel I'd suggest the following to avoid this issue. This is happening because your intent receiver is a catch-all and seems to interfere with the Authentication callback

  1. Use a different scheme for authentication or your login.
  2. Specify the exact android:pathPrefix for which you want to open your app. Now it will open for all links which has the scheme that is your application_id

poovamraj avatar Oct 18 '22 09:10 poovamraj

Hi @mailaneel @lehuydev2203 hope this answers your questions. I will close this issue for now, please feel free to reopen this if you have more doubts

poovamraj avatar Oct 18 '22 17:10 poovamraj

Hey guys, can i use this thread because i have the exact similar problem. So in Callback URLS i do have just 1 for my application but then this modal Open with pop up and it has 2 times the application just like on the screenshot above. So from this suggestion https://github.com/auth0/react-native-auth0/issues/536#issuecomment-1282134579 1. is true but should i do 2. if i have unique scheme and still see open with twice with my app?

@poovamraj i have my callback url like this:

dev.environment.my.app://auth.opn.network/android/dev.environment.my.app/callback

and i have builded intent url like this using react native expo:

android: {
  intentFilters: [
  {
              action: 'VIEW',
              autoVerify: true,
              data: [
                {
                  scheme: 'dev.environment.my.app',
                  pathPrefix: '/android/dev.environment.my.app/callback',
                },
              ],
              category: ['BROWSABLE', 'DEFAULT'],
            }
]
}

but still i see this pop up Open with and it has application 2 times

AndonMitev avatar Dec 10 '22 08:12 AndonMitev

@AndonMitev did you try using the command mentioned here - https://github.com/auth0/react-native-auth0/issues/536#issuecomment-1280627909 to try and debug which activity is causing this?

poovamraj avatar Dec 12 '22 11:12 poovamraj

Hey @poovamraj bro i have shared detailed info here: https://github.com/auth0/react-native-auth0/issues/554#issuecomment-1346664166

AndonMitev avatar Dec 12 '22 13:12 AndonMitev