Google Drive SDK JavaScript文件共享对话框提供了“由于X-Frame-Options禁止显示而拒绝显示文档” [英] Google Drive SDK JavaScript file sharing dialog gives "Refused to display document because display forbidden by X-Frame-Options"

查看:175
本文介绍了Google Drive SDK JavaScript文件共享对话框提供了“由于X-Frame-Options禁止显示而拒绝显示文档”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用此处介绍的Javascript代码来使用Google SDK文件共享对话框: https ://developers.google.com/drive/manage-sharing



我设置了API密钥并配置了Google Drive SDK面板: https://code.google.com/apis/console/



我可以使用API​​密钥和JavaScript成功列出存储在Google云端硬盘中的文件,但共享代码无法使用。一个仅包含加载微调器的对话框出现,然后显示很抱歉,此时共享不可用。而Chrome浏览器Javascript控制台在Chrome中包含拒绝显示文档,因为X-Frame-Options禁止显示错误。在Firefox中,我收到错误:

错误:错误:权限被拒绝访问属性'_EmailAc_create'
源文件:docs.google.com/static/ doclist / client / js / 1880332762-v2-doclist_share__en_gb.js
Line:470



任何想法出了什么问题?

b

X-Frame-Options用于防止对整个服务器发生点击劫持攻击,方法是禁止任何具有指定头部的页面进行iframed。据我所知,谷歌浏览器在指定的应用程序安装为Chrome网络应用程序时解除了这一限制,因此可能您的网页应用程序配置不当。






另外还有另一个答案它可能也必须处理您的设置在控制台显然:


您需要确定两件事:


  1. 您在Google Drive SDK中设置的open with网址
    Google API控制台中的设置必须与使用共享对话框的页面具有相同的域

  2. 目前,您的
    需要您的应用程序为安装在您的Google云端硬盘上,以便使
    可嵌入的小部件可以正常工作。



I'm trying to use the Google SDK file sharing dialog using the Javascript code described here: https://developers.google.com/drive/manage-sharing

I have an API key set up and have configured the Google Drive SDK panel as well: https://code.google.com/apis/console/

I can successfully list files stored on Google Drive using the API key and JavaScript but the sharing code does not work. A dialog that only contains a loading spinner appears and then it says "Sorry, sharing is unavailable at this time." and the Chrome Javascript console contains the error "Refused to display document because display forbidden by X-Frame-Options" in Chrome. In Firefox, I get the error:

Error: Error: Permission denied to access property '_EmailAc_create' Source File: docs.google.com/static/doclist/client/js/1880332762-v2-doclist_share__en_gb.js Line: 470

Any idea what is going wrong?

解决方案

Ok, as nobody has been able to give you any advice at all, let me give you some low quality advice at least.

X-Frame-Options are used to prevent clickjacking attacks against an entire server by disallowing any pages with the specified header to be iframed. As far as I know google chrome lifts this restriction when the specified app is installed as a chrome web application, so probably your accompying web app isn't configured properly.


Additionally from another answer it could also have to do with your settings in the console apparently:

You need to make sure of 2 things:

  1. The "open with" URL that you have setup in your Google Drive SDK settings in the Google APIs Console has to have the same domain that the page where you are using the sharing dialog.
  2. Currently you alos need your application to be installed on your Google Drive for the embeddable widget to work.

这篇关于Google Drive SDK JavaScript文件共享对话框提供了“由于X-Frame-Options禁止显示而拒绝显示文档”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆