使用 2 个参数创建 Firebase 动态 link
Create Firebase dynamic link with 2 params
我正在为我们的网站创建一个新动态 link。我使用“https://firebasedynamiclinks.googleapis.com/v1/shortLinks". We already have a shortUrl that is created from "https://example.com/v=5e4eafa80a863710813bc67b?s=ABCDEF”通过我们的 NodeJs 后端 api 手动创建它们,它工作正常。
现在我需要用第二个参数创建一个:“https://example.com/reset?email=test@email.com&token=123456”
shortUrl 中包含第一个参数(电子邮件),但删除了第二个参数(令牌)。我需要配置一些东西来包含第二个吗?
我收到了来自 Firebase Slack 支持的回复
I think your problem arises because Google Servers expects the data for the deep link it sends to your app to be in only one specific name/value pair. When you create a second parameter using the & the server parsing the dynamic link, is expecting a new name/value pair and thus does not see or even know what to do with the data you sent. It never makes it to your server.
I was thinking about this problem the other day before I read your post. Let's use the manual construction link as an example found at https://firebase.google.com/docs/dynamic-links/create-manually
Here is an example dynamic link created manually:
https://your_subdomain.page.link/?link=your_deep_link&apn=package_name[&amv=minimum_version][&afl=fallback_link]
The part you are interested in is ?link=your_deep_link. If you try to add another name/value pair to that deep your_deep_link by doing something like ?link=email=test@email.com&token=018265, that ampersand (&) before token is probably causing the Google servers to read it as a separate name/value pair that does not belong to your_deep_link.
In the example I posted above, you can see the ampersand after your_deep_link is supplying a new name/value pair that the Google Servers parse to use.
Your language should have some equivalent to PHP explode https://www.php.net/manual/en/function.explode.php or C# string split
https://docs.microsoft.com/en-us/dotnet/csharp/how-to/parse-strings-using-split
I would construct a string that used a colon (:) (or some other character that I'm sure is not part of my regular deep-link, as the delimiter so your deep-link would look like
?link=https://your.domain/reset?email=test@email.com:018265"
Once you get the link, pull the data from it using the explode equivalent of your language.
我正在为我们的网站创建一个新动态 link。我使用“https://firebasedynamiclinks.googleapis.com/v1/shortLinks". We already have a shortUrl that is created from "https://example.com/v=5e4eafa80a863710813bc67b?s=ABCDEF”通过我们的 NodeJs 后端 api 手动创建它们,它工作正常。
现在我需要用第二个参数创建一个:“https://example.com/reset?email=test@email.com&token=123456”
shortUrl 中包含第一个参数(电子邮件),但删除了第二个参数(令牌)。我需要配置一些东西来包含第二个吗?
我收到了来自 Firebase Slack 支持的回复
I think your problem arises because Google Servers expects the data for the deep link it sends to your app to be in only one specific name/value pair. When you create a second parameter using the & the server parsing the dynamic link, is expecting a new name/value pair and thus does not see or even know what to do with the data you sent. It never makes it to your server.
I was thinking about this problem the other day before I read your post. Let's use the manual construction link as an example found at https://firebase.google.com/docs/dynamic-links/create-manually
Here is an example dynamic link created manually: https://your_subdomain.page.link/?link=your_deep_link&apn=package_name[&amv=minimum_version][&afl=fallback_link] The part you are interested in is ?link=your_deep_link. If you try to add another name/value pair to that deep your_deep_link by doing something like ?link=email=test@email.com&token=018265, that ampersand (&) before token is probably causing the Google servers to read it as a separate name/value pair that does not belong to your_deep_link.
In the example I posted above, you can see the ampersand after your_deep_link is supplying a new name/value pair that the Google Servers parse to use.
Your language should have some equivalent to PHP explode https://www.php.net/manual/en/function.explode.php or C# string split https://docs.microsoft.com/en-us/dotnet/csharp/how-to/parse-strings-using-split
I would construct a string that used a colon (:) (or some other character that I'm sure is not part of my regular deep-link, as the delimiter so your deep-link would look like ?link=https://your.domain/reset?email=test@email.com:018265"
Once you get the link, pull the data from it using the explode equivalent of your language.