首页 文章

Firebase Android:电子邮件链接身份验证 . intent-filter无效

提问于
浏览
4

我正在为Android实施firebase Email Link身份验证机制 . 我已经使用firebase的指南实现了它 . 但是现在从电子邮件打开链接后,应用程序总是进入启动器活动 . 我无法调试此问题 . 我也在我的应用程序中实现了动态链接,并且工作正常 . 这是我的意图过滤器:

<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>

这是我正在使用的ActionCodeSetting:

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();

任何人都可以弄清楚我在这里做错了什么或错过了一些东西

来自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:

我通过在我的启动器活动的onResume数据中记录intent数据进行检查,并且我得到了firebase身份验证返回的数据,所以看起来我认为动态链接存在某种问题 .

我的firebase邀请版本是15.0.0,因为15.0.2给了我错误(在文档中更新但我认为没有实际发布 . )

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

EDIT 2: 使用firebase示例进行无密码登录示例时,也存在同样的问题 . 我在GitHub上创建了一个问题

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

1 回答

  • 3

    我和你有同样的问题 . 要解决它,我删除pathPrefix并设置我的域的url而不是intent过滤器中的动态链接,它似乎工作 .

    <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>
    

    希望它会有所帮助

相关问题