使用 Google Drive API 在 Javascript 应用程序中打开共享对话框时出现 JS 错误.错误是:未捕获的错误:语法错误:DOM 异常 12.
I'm having a JS error when opening a share dialog in a Javascript application using the Google Drive API. The error is: Uncaught Error: Syntax Error: DOM Exception 12.
但是,当我退出所有 Google 帐户然后只登录一个帐户时,共享对话框可以正常工作.当我在新标签页中登录第二个帐户后,共享对话框将不再起作用,并因上述错误而失败.
However, the sharing dialog works fine when I log out of all Google accounts and then log into just one account. As soon as I log into a second account in a new tab, the sharing dialog no longer works and fails with the above error.
这与 非常相似在 Google Drive SDK 上调用 showSettingsDialog() 会引发拒绝显示文档,因为 X-Frame-Options 禁止显示.但是,我已经完成了接受响应中显示的调试,但无济于事,即:
This is very similar to Calling showSettingsDialog() on the Google Drive SDK throws a Refused to display document because display forbidden by X-Frame-Options. However, I have done the debugging shown in the accepted response to no avail, namely:
相关代码为:
var shareClient = new gapi.drive.share.ShareClient(rtpg.realTimeOptions.appId);
shareClient.setItemIds([rtclient.params['fileId']]);
shareClient.showSettingsDialog();
有没有办法让登录的多个帐户也能正常工作?
Is there some way to make this work with multiple accounts signed in?
您可能需要仔细阅读有关 x-frame 问题的内容:
you might want to read this carefully concerning the x-frame issue:
谷歌Drive API,无法通过 JS 打开标准共享对话框(x-frame-options 错误)
但我认为不可能一次对所有帐户进行身份验证,但每次您想要这样做时,可能有一种解决方法setOAuthToken 对每个帐户进行身份验证.
but what i think it is not possible to authenticate all the accounts at once , but a workaround maybe to setOAuthToken to each of them everytime you want to do so.
在 google 文档中说明:
it is stated here in google documents that :
重要提示:setOAuthToken 函数允许应用使用当前身份验证令牌,用于确定选择器使用哪个 Google 帐户显示文件.如果用户登录了多个 Google 帐户,这允许选择器显示适当的文件授权帐号.
Important:The setOAuthToken function allows an app to use the current auth token to determine which Google account the picker uses to display the files. If a user is signed into multiple Google accounts, this allows the picker to display the files of the appropriate authorized account.
来源:
https://developers.google.com/drive/web/integrate-open
这篇关于登录多个帐户时无法使 Google Drive API 共享对话框工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
discord.js v12:我如何等待 DM 频道中的消息?discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 频道中的消息?)
如何让我的机器人提及发出该机器人命令的人how to make my bot mention the person who gave that bot command(如何让我的机器人提及发出该机器人命令的人)
如何修复必须使用导入来加载 ES 模块 discord.jsHow to fix Must use import to load ES Module discord.js(如何修复必须使用导入来加载 ES 模块 discord.js)
如何列出来自特定服务器的所有成员?How to list all members from a specific server?(如何列出来自特定服务器的所有成员?)
Discord bot:修复“找不到 FFMPEG"Discord bot: Fix ‘FFMPEG not found’(Discord bot:修复“找不到 FFMPEG)
使用 discord.js 加入 discord 服务器时的欢迎消息Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服务器时的欢迎消息)