Firebase Android: Email Link Authentication. intent-filter not working

时间秒杀一切 提交于 2019-12-23 15:28:01

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/50175974/firebase-android-email-link-authentication-intent-filter-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!