我正在尝试在我的网站中使用Google云端硬盘选择器API,允许用户选择Google云端硬盘文档。我有完整的选择器窗口,它返回一个对象,其中包含与所选文档有关的所有元数据。但是,我需要的是来自文档的可共享链接,允许其他非Google用户访问和查看文档。返回的网址均未符合我的要求。我应该使用不同的API吗?
HTML: 选择文件
$host
Filepicker.js:
<script src="filepicker.js"></script>
<script>
function initPicker() {
var picker = new FilePicker({
apiKey: 'APIKEYHERE',
clientId: 'CLIENTIDHERE',
buttonEl: document.getElementById('pick'),
onSelect: function(file) {
console.log(file);
alert('Selected ' + file.title);
console.log("https://docs.google.com/document/d/" + file.id);
}
});
}
</script>
<script src="https://www.google.com/jsapi?key=APIKEYHERE"></script>
<script src="https://apis.google.com/js/client.js?onload=initPicker"></script>