2016-09-16 51 views
0

我试图使用Javascript Preview SDK从我的Web应用程序中读取帐户帐户中的所有文件。我希望从我的自定义Web应用程序中预览我的箱子帐户上的所有文件。有一些方法可以使用默认的ID,允许我阅读箱子帐户中的所有文件夹和文件?BOX API,使用Box javascript预览SDK读取我的帐户帐户中的所有文件

目前,我正在尝试使用:

Box.Preview.show('FILE_ID',{ 
     token: access_token, 
     container: '.preview-container', 
     showDownload: true 
     }); 

access_token是通过this页中所述的方法获得。此外,使用上面的代码我得到这个错误:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:3000 ' is therefore not allowed access. The response had HTTP status code 404. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

如何设置使用Javascript Preview SDK请求头? 感谢您的回复。

回答

0

您必须将应用程序的网址(http://localhost:3000)添加到CORS Allowed Origins文本区域。您可以使用您用于创建应用程序的表单来查找该字段,该表单也是您获得开发人员令牌的相同表单。注意:避免在URL中使用尾部斜杠。

+0

我有这个问题,即使我已经添加它,有什么建议吗? –

相关问题