我是 Firebase 新手。我正在尝试使用动态链接。这就是我到目前为止所拥有的......
var longUrl = 'https://example.com/' + window.location.hash;
var APIkey = 'My Web API Key Here';
var url = 'https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=' + APIkey;
var data = {
"longDynamicLink": "https://abc123.app.goo.gl/?link=" + longUrl,
"suffix": {
"option": "SHORT"
}
};
var request = $.ajax({
url: url,
dataType: 'json',
type: 'post',
contentType: 'application/json',
data: JSON.stringify(data),
processData: false,
success: function( data, textStatus, jQxhr ){
console.log(data);
console.log(textStatus);
console.log(jQxhr);
},
error: function( jqXhr, textStatus, errorThrown ){
console.log( errorThrown );
}
});
我收到了 400 错误...
code:400
message:"Your project has not configured Dynamic Links. [https://firebase.google.com/docs/dynamic-links/rest#before_you_begin]"
status:"INVALID_ARGUMENT"
未配置动态链接是什么意思? “abc123”只是一个占位符吗?
最佳答案
有同样的问题 - 这就是我从 firebase 团队得到的答案:
Take note that to be able to view your Dynamic Link domain you'll have to add an app first. If you're using Firebase Dynamic Link as a substitute to Google Shortener, you can create a sample application (dummy app) for your project to proceed creating a Firebase Dynamic Links. Just enter dummy values for the iOS bundle ID or Android package name (ex: “my.dummy.app”) to continue.
然后你将输入从中获得的ID(例如 https://dedfgu.app.goo.gl ) 而不是占位符 (abc123.app.goo.gl)。
祝你好运!
关于javascript - Firebase URL 缩短器与 jQuery Ajax Post?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47408591/