问题描述
我开发Google Drive应用程序。我有下载文件的问题。官方文档使用下列词语描述了这个过程:要下载文件的内容,请将授权的HTTP GET请求发送到文件的downloadUrl。。主要问题在于授权HTTP GET请求。我已使用:
- 登录名:password @ downloadUrl
- downloadUrl& access_token = {my_token}
- downloadUrl& access_key = {my_token}
- downloadUrl& key = {my_token}
这些都没有帮助我。如果我尝试下载文件,它会在第一次打开浏览器进行授权。
您是否可以帮助我在没有用户授权的情况下下载文件?
要下载文件内容,您需要使用授权HTTP请求中的OAuth 2.0访问令牌,例如:
GET< dowloadUrl>
授权:持票人< ACCESS_TOKEN>
您可以使用 curl
一个命令如:
curl< downloadUrl> -H'Authorization:Bearer< ACCESS_TOKEN>'
如果您希望能够下载文件从使用cookie身份验证的web浏览器(使用当前登录用户的cookie),您应该使用 webContentLink
。
I develop application for Google Drive. I have problem with downloading files. Official doc describes this process with next words: "To download a file's content, send an authorized HTTP GET request to the file's downloadUrl.". The main problem is in "authorized HTTP GET request". I've used:
- login:password@downloadUrl
- downloadUrl&access_token={my_token}
- downloadUrl&access_key={my_token}
- downloadUrl&key={my_token}
And none of these have helped me. If I try to download file it opens browser for authorization in the very first time.Can you help me download file without usermade authorization?
To download the file's content, you will need to use an OAuth 2.0 access token in an authorized HTTP request such as:
GET <dowloadUrl>
Authorization: Bearer <ACCESS_TOKEN>
You can try this with curl
by using a command such as:
curl <downloadUrl> -H 'Authorization: Bearer <ACCESS_TOKEN>'
If you want to be able to download the file from a web browser using cookie authentication (using the cookies of the currently logged-in user), you should use the webContentLink
instead.
这篇关于谷歌驱动器和授权HTTP GET下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!