简体   繁体   English

将 Firebase 动态链接中的网址列入白名单

[英]Whitelisting URLs in Firebase Dynamic Link

I setup a dynamic link to invite users to download my app or be sent to my website (I own the domain but haven't built it yet format: www.my-domain.com) with Firebase Dynamic Links.我设置了一个动态链接以邀请用户下载我的应用程序或发送到我的网站(我拥有域但尚未构建它格式:www.my-domain.com)和 Firebase 动态链接。 Firebase recommends whitelisting URL patterns in the Firebase console, however I am unfamiliar with the RE2 syntax they require. Firebase 建议在 Firebase 控制台中将 URL 模式列入白名单,但是我不熟悉他们需要的 RE2 语法。

There are examples on Firebase and so I tried two: Firebase 上有示例,所以我尝试了两个:

  1. ^ https://my-domain.com/ .*$ ^ https://my-domain.com/ .*$

  2. ^ https://www.my-domain.com/ .*\wshare?\wshareProfileName=\wBecky%20\wThomas$ (where Becky Thomas is a users name & changes for each user) ^ https://www.my-domain.com/ .*\wshare?\wshareProfileName=\wBecky%20\wThomas$(其中 Becky Thomas 是用户名并针对每个用户进行更改)

I'm testing this on my iPhone and would expect this to work & be able to share the link however nothing happens and I receive the following error in the Xcode terminal:我正在我的 iPhone 上对此进行测试,希望它能正常工作并能够共享链接,但是没有任何反应,我在 Xcode 终端中收到以下错误:

"Error Domain=com.firebase.durabledeeplink Code=0 "We could not match param 'https://www.my-domain.com/share?shareProfileName=James%20Thomas ' with whitelisted URL patterns in your Google project. “Error Domain=com.firebase.durabledeeplink Code=0 “我们无法将参数“https://www.my-domain.com/share?shareProfileName=James%20Thomas ”与您的 Google 项目中列入白名单的 URL 模式相匹配。 [ https://support.google.com/firebase/answer/9021429] [ https://support.google.com/firebase/answer/9021429] " [ https://support.google.com/firebase/answer/9021429] [ https://support.google.com/firebase/answer/9021429]

Any advice would be much appreciated任何建议将不胜感激

The example didn't work for me either, I got it working by removing some of the slashes.这个例子对我也不起作用,我通过删除一些斜线来让它工作。 This is the pattern I'm using...这是我正在使用的模式...

^https://example.com.*$

If you want to match sub domains too you can use this...如果你也想匹配子域,你可以使用这个......

^https://.*example.com.*$

Use this expression:使用这个表达式:

^https://www\.my-domain\.com/share\?shareProfileName=.+$

It's more restrictive because only accept the exact url with different values for shareProfileName.它更具限制性,因为只接受具有不同 shareProfileName 值的确切 url。

Test the expressions on https://regex101.com/测试https://regex101.com/上的表达式

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

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