使 firebase 动态化时发生错误 link。包括错误代码
An error occurred while making firebase dynamic link. include error code
<script>
var URL = 'https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=MY_KEY'
const req = new Request(URL,{
method : "POST",
headers : new Headers({
"Content-Type" : "application/json"
}),
context: {
"longDynamicLink" : "https://MY_DOMAIN.page.link/?link=EXAMPLE_LINK",
"suffix" : {
"option" : "SHORT"
}
}
});
var response = fetch(req).then(res=>res.json()).then(json => console.log(JSON.stringify(json)));
</script>
我想制作短链接。我的 longDynamiclink 正在工作
所以我发送了请求,但收到了以下回复。
{code: 400
message: "Unsupported dynamic link request
DYNAMICLINK_NOT_SET.[https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters]"
status: "INVALID_ARGUMENT"}
我的代码有问题吗?还是我提出了错误的要求?请告诉我如何修复我的代码以获得正确的响应。
谢谢。
先看看这个:
- 确保您已经将 SHA1 和 SHA256 证书指纹添加到您的 Firebase 项目配置中
- 在 console.cloud.google.com 控制台为您的项目启用 "Firebase Dynamic Links API"
<script>
var URL = 'https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=MY_KEY'
const req = new Request(URL,{
method : "POST",
headers : new Headers({
"Content-Type" : "application/json"
}),
context: {
"longDynamicLink" : "https://MY_DOMAIN.page.link/?link=EXAMPLE_LINK",
"suffix" : {
"option" : "SHORT"
}
}
});
var response = fetch(req).then(res=>res.json()).then(json => console.log(JSON.stringify(json)));
</script>
我想制作短链接。我的 longDynamiclink 正在工作 所以我发送了请求,但收到了以下回复。
{code: 400
message: "Unsupported dynamic link request DYNAMICLINK_NOT_SET.[https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters]"
status: "INVALID_ARGUMENT"}
我的代码有问题吗?还是我提出了错误的要求?请告诉我如何修复我的代码以获得正确的响应。
谢谢。
先看看这个:
- 确保您已经将 SHA1 和 SHA256 证书指纹添加到您的 Firebase 项目配置中
- 在 console.cloud.google.com 控制台为您的项目启用 "Firebase Dynamic Links API"