【问题标题】:Angular handle query params with multiple question marks带有多个问号的角度句柄查询参数
【发布时间】:2020-12-05 05:22:39
【问题描述】:

我正在尝试处理由 Firebase 自动生成到我在网络平台上的 Ionic/Angular 应用程序中的电子邮件确认链接。 我尝试过使用 Deeplink cordova 插件(文档说它支持网络)但返回“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-framework firebase-authentication progressive-web-apps deep-linking


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 2020-01-10
      • 2010-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多