capacitor-community / generic-oauth2

Generic Capacitor OAuth 2 client plugin. Stop the war in Ukraine!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android Google success shows 2 duplicate apps to return to on success

jbrown0824 opened this issue · comments

I set up Facebook and Google for Android. Facebook works as expected. However, with Google, after I've selected which account to connect, it then asks me to choose which app to go back to. It lists the correct app, but it lists it twice for some reason. Selecting one completely reopens the app, and so the connection doesn't work. Selecting the other takes you back to the open app and it DOES work.

The screenshot shows it split based on which I had previously selected but the first time it asked me it showed both in a list, both with app.temployee.app as the package name

Do you have any idea what I could be doing wrong?

screen shot 2018-12-20 at 12 47 10 pm

Hi,

I experience the same behavior but only on simulator and while debugging on a device. In a production build the dialog is not displayed but users reported some weird problems.

Unfortunately I have no idea where this comes from. So if you have any logs or find anything please let me know so I can tackle the problem.

BR, Michael

@moberwasserlechner I just tried installing it on a real device and am experiencing the same issue. I'm not very experienced with native android development (yet). Could you point me in a direction to find some logs that we can look through to try and diagnose the issue?

Only if you release it in the Playstore the issue should be gone.

If you don't have any logs it's ok. I will try to find the bug myself but after the holidays ;)

I think the schemes in the gradle file and the a scheme in a intent filter in the androidManifest.xml

build.gradle

android.defaultConfig.manifestPlaceholders = [
  'appAuthRedirectScheme': 'com.company.product'
]

are conflicting each other.

AndroidManifest.xml ... @string/custom_url_scheme

<activity
      android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
      android:name="com.byteowls.teamconductor.MainActivity"
      android:label="@string/title_activity_main"
      android:theme="@style/AppTheme.NoActionBarLaunch">

      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>

      <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="@string/custom_url_scheme" />
      </intent-filter>

    </activity>

I have no solution yet but you might try to change on or the other.

I have stumbled upon the same issue, will see if doing above will solve anything

I was able to fix this by adding android:host here:

            <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="@string/custom_url_scheme" android:host="@string/custom_host" />
            </intent-filter>

@michaeltintiuc cool. What value has @string/custom_host? Is it the same as @string/custom_url_scheme?
thx

Looks like it could be anything, I had it set to foo and oauth no difference whatsoever

I just tried it (foo ;)) and it works. Will add this to the docs. Great find.

Added a section formulated by @rgolea

Hi Guys, I keep getting this on debug and release versions, does any of you know what can be done to fix this? I have followed the steps that were added to the documentation.

@loonix I'm having the same issue on the emulator where it's displaying a duplicate app to return control to, (I haven't tested the release version) but I seemed to have gotten around it with the following configuration

build.gradle

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "your-app"
       ...
        manifestPlaceholders = ['appAuthRedirectScheme': 'your-scheme']
    }
    ...
}

strings.xml

<?xml version='1.0' encoding='utf-8'?>
<resources>
    ...
    <string name="custom_url_scheme">your-scheme</string>
</resources>

AndroidManifest.xml

    <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="none" />  <!-- might not be needed?? -->
    </intent-filter>

I'm not an Android developer so I can't explain why this configuration is working for me, but it might be of help.

Thanks.

Thanks bro, will give it a shot

Hi. I'm using this plugin in my ionic/capacitor project and follow the setup described for Android. Everything was working great using the emulator but when I installed the .apk in my android device, the app launch icon was not on the screen, though the installation was successful and the app was listed in installed apps. After some try/error attemptives, I figured out that if I removed the fix for this issue ( <data android:scheme="@string/custom_url_scheme" android:host="oauth" /> in AndroidManifest.xml), I was able to run the app in the device, as expected. Do you know why is this happening? Also, with or without the fix, I did not experience the bug reported in this issue.
Thanks.

Hi @marianapatcosta,

you wrote:

Also, with or without the fix, I did not experience the bug reported in this issue.

You did not experience this issue. Could you please create a new issue, describing your problem and giving the information asked by the issue template.

Thx & BR