file作用域的AuthToken返回404

file作用域的AuthToken返回404

本文介绍了drive.file作用域的AuthToken返回404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Google选择器从Google驱动器中选择文件.选择器使用drive.file范围.然后,将文件ID传递到我们要在其中下载文件的服务器端.当前,当我们使用针对drive.file范围生成的访问令牌时,驱动器API返回404响应.如果我们将范围更改为驱动器,则可以成功下载文件,因此我们知道该文件存在.我认为问题是令牌没有正确的特权?

We are using a Google picker to select a file from Google drive. The picker uses the drive.file scope. The file ID is then passed server side where we want to download the file. Currently when we use the access token generated against the drive.file scope the drive API returns a 404 response. If we change the scope to drive we can successfully download the file, so we know it exists. I assume the issue is that the token does not have the right privileges?

是否可以请求一个令牌,该令牌将允许在不增加驱动器范围的情况下进行访问?我们的应用仅需要对所​​选文件的许可,并且仅在这种情况下,但下载需要在服务器端完成.

Is it possible to request a token that will allow access without the elevated drive scope? Our app only needs permission on the selected file, and only on this occasion but the download needs to be done server side.

推荐答案

如果您不想使用 https://www.googleapis.com/auth/drive ,请尝试使用 https://www.googleapis.com/auth/drive.readonly 作为下载文件指出:

If you don't want to use the https://www.googleapis.com/auth/drive, try using the https://www.googleapis.com/auth/drive.readonly as the Download Files states that:

这篇关于drive.file作用域的AuthToken返回404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 10:31