0

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.

Rob West
  • 5,189
  • 1
  • 27
  • 42

1 Answers1

0

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:

Downloading the file requires the user to have at least read access. Additionally, your app must be authorized with a scope that allows reading of file content.

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
  • The drive.readonly is still a more elevated privilege than I'd like - surely the drive.file scope is precisely what we should be using as we only want one time access to the selected file – Rob West Jan 03 '18 at 17:29
  • These are the options available to you. If it doesn't meet your needs, you can always write your own library :) – ReyAnthonyRenacia Jan 03 '18 at 23:02
  • But @noogui the option I want is https://www.googleapis.com/auth/drive.file as I only need to access the selected file - my question is why the access token generated isn't working. Suggesting a different scope isn't addressing that – Rob West Jan 04 '18 at 11:52