简体   繁体   English

如何使用其API在Google驱动器中打开文件?

[英]How do I open a file in google drive using its api?

I'm trying to display a text file from google drive in a textarea. 我正在尝试在textarea中显示来自Google驱动器的文本文件。 From what I understand there is no direct way to do it; 据我了解,没有直接的方法可以做到。 you have to download it using xhr request. 您必须使用xhr请求下载它。 I have tried the code that google provide in their documentation [https://developers.google.com/drive/v2/reference/files/get][1] but with no success. 我尝试了Google在其文档[https://developers.google.com/drive/v2/reference/files/get][1]中提供的代码,但没有成功。

The Error I'm getting is "500 (Internal Server Error)" The code is the exact the same as in the google's example. 我得到的错误是“ 500(内部服务器错误)”,该代码与Google的示例完全相同。 Can someone help me with this problem? 有人可以帮我解决这个问题吗?

Are you making sure you have an access token before sending the request? 在发送请求之前,您是否确定拥有访问令牌? And are you using the example JavaScript provided ? 并且您正在使用提供示例JavaScript吗?

Authorizing Your App with Google Drive : 使用Google云端硬盘授权您的应用

All requests to the Google Drive API must be authorized by an authenticated user. 所有对Google Drive API的请求都必须由经过身份验证的用户授权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM