5
votes

I'm implementing the firebase Email Link Authentication Mechanism for Android. I have implemented it using the guide by firebase. But now after opening link from email the app always goes to launcher activity. I'm not able to debug the issue. I have also dynamic link implemented in my app and that works fine. Here is my intent filter:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />

    <data android:scheme="http" />
    <data android:scheme="https" />
    <data android:host="www.example.com" />
    <data android:pathPrefix="/emailSignInLink" />

</intent-filter>

And here is the ActionCodeSetting I'm using:

ActionCodeSettings settings = ActionCodeSettings.newBuilder()
                .setAndroidPackageName(
                        BuildConfig.APPLICATION_ID,
                        false, /* install if not available? */
                        null   /* minimum app version */)
                .setHandleCodeInApp(true)
                .setUrl("https://www.example.com/emailSignInLink")
                .build();

Can anyone figure out what I'm doing wrong here or missing some thing

Sample from firebase:

https://github.com/firebase/quickstart-android/blob/master/auth/app/src/main/AndroidManifest.xml

https://github.com/firebase/quickstart-android/blob/master/auth/app/src/main/java/com/google/firebase/quickstart/auth/PasswordlessActivity.java

EDIT 1:

I checked by logging intent data in my launcher activity's onResume data and I'm getting the data returned by firebase authentication, so it looks like some kind of issue with Dynamic Link I think.

My version of firebase invites is 15.0.0 as 15.0.2 is giving me error (updated in docs but not actually released I think.)

implementation "com.google.firebase:firebase-invites:15.0.0"

EDIT 2: The same issue is also present when using the firebase sample for passwordless login example. I have created a issue on GitHub

https://github.com/firebase/quickstart-android/issues/488

2
is this intent-filter defined in your desire activity?H.Taras
Yes the intent filter is in the required activity, but that activity is not my launcher activity (i.e. it doesn't have the launcher intent-filter).Umar Hussain
The domain is white listed, as this process fails before sending email and throws error that domain is not white listed.Umar Hussain
Can you try replacing the host/path in the intent filter with the domain in the link= value from the email link and make sure it's authorized in the Auth section of the Firebase console? Should look like <projectID>.firebaseapp.comnot_a_bot

2 Answers

3
votes

I just have the same problems as you. To solve it I remove the pathPrefix and set the url of my domain instead of the dynamic links in the intent filter and it seems to work.

 <intent-filter>
      <action android:name="android.intent.action.VIEW" />
      <data
           android:scheme="https"
           android:host="myfirebaseId.firebaseapp.com"/>
      <category android:name="android.intent.category.BROWSABLE" />
      <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Hoping it will help

2
votes

I had the same problem as you. I have solved it. In the manifest, in android:host I do put a Dynamic link domain!

Like thay said in https://firebase.google.com/docs/dynamic-links/android/receive

Note that the android:host must be set to your Dynamic Links domain, and not the domain of your deep link.

In Manifest:

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.BROWSABLE" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:host="myDynamicLink.page.link" android:scheme="https" />
</intent-filter>

In my secondery activity:

ActionCodeSettings actionCodeSettiongs = ActionCodeSettings.newBuilder()
        .setAndroidPackageName(getPackageName(), false, null)
        .setHandleCodeInApp(true)
        .setUrl("https://auth.example.com")
        .build();

The generated URL for my email then like: "https://myDynamicLink.page.link/?link=https://myApp.firebaseapp.com...continueUrl%3Dhttps://auth.example.com..."


P.S. This all confusing because they in their Guids as an example put link "https://example.com", not a "http://example.page.link"