首页 > 解决方案 > 带有多个问号的角度句柄查询参数

问题描述

我正在尝试将 Firebase 自动生成的电子邮件确认链接处理到我在网络平台上的 Ionic/Angular 应用程序中。我尝试过使用 Deeplink cordova 插件(文档说它支持 Web),但返回“cordova_not_available”错误。我试过使用电容器 App 插件,但它在浏览器上返回一个默认的空字符串。我试过调用location.toString(),但链接在查询参数值中包含多个问号,并且从第二个问号开始的所有内容都被删除。Firebase 生成的链接如下所示:

https://example.com?link=https://example.com?apiKey%3D{myApiKey}%26mode%3DverifyEmail%26oobCode%3D{theCodeIneed}%26continueUrl%3Dhttps://example.com/email-confirmed%26lang%3Den&apn=com.example.myAppName&amv&ibi=com.example.myAppName&ifl=https://example.com?apiKey%3D{myApiKey}%26mode%3DverifyEmail%26oobCode%3D{theCodeIneed}%26continueUrl%3Dhttps://example.com/email-confirmed/%26lang%3Den

但我从中得到的location.toString()(迄今为止最好的)只是:

https://example.com?link=https://example.com

所以我无法获得oobCode参数,这是我需要确认用户拥有该电子邮件地址

有没有办法获取完整链接?

标签: ionic-frameworkfirebase-authenticationprogressive-web-appsdeep-linking

解决方案


终于发现通过handleCodeInApp = false在sendPasswordResetEmail或sendEmailVerification Firebase方法的actionCodeSettings参数中设置,Firebase自动生成的链接恰好只有一个问号(我不知道为什么),因此可以通过location.toString()检索来管理它oob 代码。


推荐阅读