Google drive api 无法显示对话框gapi.drive.share.ShareClient
代码行:Google drive api 无法显示对话框gapi.drive.share.ShareClient,google-drive-api,Google Drive Api,代码行: gapi.auth.authorize({ client_id: clientId, scope: scopes, immediate: false}, function (authResult) { gapi.client.load('drive', 'v2', function () { gapi.load('drive-share', function () { var client = new gapi.drive.share.ShareClient(key)
gapi.auth.authorize({ client_id: clientId, scope: scopes, immediate: false},
function (authResult)
{
gapi.client.load('drive', 'v2', function () {
gapi.load('drive-share', function () {
var client = new gapi.drive.share.ShareClient(key);
client.setItemIds([pathId]);
client.showSettingsDialog();
});
});
}
它始终显示错误消息,而不是共享对话框:
Sorry, sharing is unavailable at this time. Please try again later
在消息框中。您的项目是否将页面作为JavaScript源代码包含在API控制台上?我发布了localhost:port以重定向URI和JS源代码。调用函数gapi.client.drive.files.list();工作正常,gapi.client.drive.files.trash工作正常,但共享不是faik“localhost”不起作用。您需要在127.0.0.1的/etc/hosts文件中创建一个别名,并在API控制台中使用它