简体   繁体   English

从发送验证邮件接收深度链接 (Flutter / Firebase)

[英]Receive Deep Link from Send Verification Email (Flutter / Firebase)

We can send out an email verification like the code below.我们可以像下面的代码一样发送电子邮件验证。 I want the deep link specified to open.我想要打开指定的深层链接。 I can confirm that this deep link works on iOS.我可以确认此深层链接在 iOS 上有效。 If I run this in the terminal, the app opens correctly.如果我在终端中运行它,应用程序会正确打开。

xcrun simctl openurl booted customscheme://[LINKDOMAIN].page.link/ xcrun simctl openurl 启动 customscheme://[LINKDOMAIN].page.link/

user.sendEmailVerification(
        ActionCodeSettings(
          url: 'customscheme://[LINKDOMAIN].page.link/',
          handleCodeInApp: true,
          iOSBundleId: '[BUNDLE]',
          androidPackageName: '[PACKAGE]',
          androidInstallApp: true,
          androidMinimumVersion: '12',
        ),
      );

This shoots an email to the user with a link.这会向用户发送一封带有链接的电子邮件。 The link is very long and complicated.链接很长很复杂。 When you click the link, it will verify the email address, but it won't open the deep link.当您点击链接时,它会验证电子邮件地址,但不会打开深层链接。 I get this error:我收到此错误:

在此处输入图像描述

Error encountered This operation is not supported in the environment this application is running on.遇到错误 此应用程序运行的环境不支持此操作。 "location.protocol" must be http, https or chrome-extension and web storage must be enabled. “location.protocol”必须是 http、https 或 chrome-extension,并且必须启用网络存储。

The error is coming from Firebase.错误来自 Firebase。 I don't think it wants to let me send a deep link via email.我不认为它想让我通过电子邮件发送深层链接。 I think it wants me to use Firebase's dynamic linking system.我认为它要我使用 Firebase 的动态链接系统。 This may be true, but I don't think I need it for this simple scenario.这可能是正确的,但我认为对于这个简单的场景我不需要它。 I just need to open the app.我只需要打开应用程序。 I don't need to pass any parameters.我不需要传递任何参数。 Why is it stopping me from just opening a simple deep link?为什么它阻止我打开一个简单的深层链接?

Do I need to use Firebase's full-fledged dynamic linking system and use the Flutter SDK for that?我是否需要使用 Firebase 的成熟动态链接系统并为此使用 Flutter SDK?

Edit : I set the handleCodeInApp to false, and I'm now a step closer on Android.编辑:我将handleCodeInApp设置为 false,现在我离 Android 更近了一步。 The link verifies the email, but it doesn't open the deep link in the app.该链接会验证电子邮件,但不会打开应用程序中的深层链接。 It should open it because if I punch the Url into the browser, the app opens.它应该打开它,因为如果我将 Url 输入浏览器,应用程序就会打开。 This is what happens.这就是发生的事情。

To put this another way, the dynamic link works fine, but the link that Firebase is sending out by email is not redirecting to the correct dynamic link.换句话说,动态链接工作正常,但 Firebase 通过电子邮件发送的链接没有重定向到正确的动态链接。

在此处输入图像描述

It seems to be working on Android.它似乎适用于 Android。 The part I missed was adding the SHA1 fingerprint for the Android app.我错过的部分是为 Android 应用程序添加SHA1 指纹 I still need to get iOS working.我仍然需要让 iOS 正常工作。

The documentation says:文件说:

To learn more on how to handle sign-in with email link in an Android application, refer to the Android guide .要了解有关如何在 Android 应用程序中处理使用电子邮件链接登录的更多信息,请参阅Android 指南

To learn how to more on how to handle sign-in with email link in an Apple application, refer to the Apple platforms guide .要详细了解如何在 Apple 应用程序中使用电子邮件链接处理登录,请参阅Apple 平台指南

Specific details are provided at those addresses.这些地址提供了具体细节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM