6

I am implementing a Google File Picker, using the drive.file OAuth scope (in order to avoid usage of sensitive/restricted scopes). The picker works as expected and we are able to receive the file ID for the selected file and download the contents of it using the access token and the Drive or Sheets APIs. However, none of the image thumbnails are rendered - screenshot below. The console and network logs indicate that all the thumbnail requests are getting 403: Forbidden.

Adding the drive.readonly scope in addition to the drive.file scope in the consent flow fixes this issue - the thumbnails are successfully retrieved and rendered. Also, using the root Drive scope (https://www.googleapis.com/auth/drive) fixes the issue, since the client has full access to all content in Drive. However, both of these fixes use Restricted scopes, which I'd like to avoid.

It seems like image thumbnails may not be covered under the limited permissions of the drive.file scope, but I can't seem to find any documentation that clearly explains this. Can anyone confirm whether this is true, or whether there is a workaround that will allow for thumbnails to be rendered while using only the drive.file scope or other Recommended scopes?

missing thumbnails screenshot

2
  • Can you please share the code you are using to open the Picker? Using this example code it works with the drive.file scope. Commented Sep 9, 2020 at 14:58
  • @Alessandro - By default, the images are not displayed on thumbnails in Google Picker when using the drive.file scope. To make them visible, one has to share the image files with "anobody with the link" (or use another scope). Commented Nov 22, 2023 at 16:20

3 Answers 3

2

I'm not sure if you have been able to sort this out, but I'm having the same problem. It seems the only thumbnails showing are for files that are publicly available, and adding the (restricted) scope of https://www.googleapis.com/auth/drive.readonly does show the thumbnails.

Sign up to request clarification or add additional context in comments.

Comments

2

If anyone else has the same problem, note there are some open issues with the Google team on this, i.e. https://issuetracker.google.com/issues/311256289?pli=1 (also see the similar issues on that ticket).

It sucks that Google has marked this as "Won't fix (Intended behavior)", because it makes no sense given Google's express recommendation to use the drive.file scope with the Picker UI, as the picker is essentially unusable in grid mode if you only have the drive.file scope.

Note the situation improves somewhat if you select the DocsViewMode.LIST for your view (as opposed to the default GRID view that shows thumbnails), see https://developers.google.com/drive/picker/reference#docs-view-mode

1 Comment

Issue 208855070 is still active in Google IssueTracker and is supposed to be worked on in 2024. Please take a few seconds to give it your vote.
0

I'm seeing the same thing, thumbnails are not being rendered in grid view when using the drive.file scope. I decided to remove grid view from the file picker and just use list view. So instead of doing this:

const picker = new google.picker.PickerBuilder()
    .addView(google.picker.ViewId.DOCUMENTS)
    ...
    .build();

you can do this:

const picker = new google.picker.PickerBuilder()
    .addView(new google.picker.DocsView(google.picker.ViewId.DOCUMENTS).setMode(google.picker.DocsViewMode.LIST))
    ...
    .build();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.