Unable to get image thumbnails when using drive.file OAuth scope with Google file picker - google-picker

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

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.

Related

Google people.searchDirectoryPeople doesn't return peoples photos

I'm trying to use people.searchDirectoryPeople API to get photos from people in my organization. According to the documentation, I should have the https://www.googleapis.com/auth/directory.readonly access token, which I have provided. But results are missing the photos array ( according to the documentation there should be a photos array for each one of the results). I've set the mask to photos. If I set it to emailAddresses,photos It will return the emailAddresses array but not the photos. I can't find what I'm missing here, is there any specific scope that I should add or some other parameter.
P.S: I've added the https://www.googleapis.com/auth/userinfo.profile scope too, but no luck. Any idea where I should continue looking/investigating?
Thanks!
I've managed to find the root of the problem.
When I added a new user to my account, I added their images from the Google Amin page, but that seems to be the issue. Those photos are not shown when using the People API. When I logged in to the newly created account and changed the profile photo from there, it started showing in the results from API. Maybe it's but if you go back to Google Admin and change it again, it will stop showing again.
Looks like it's a bug in the Google Admin page or it is intended behavior but not mentioned in the documentation.
I've reported an issue: https://issuetracker.google.com/issues/228791251

open drive picker with a known fileId selected

In my webapp it can happen that a user imported an owned drive file through a copy-pasted link. At that point I already know the fileId from the link, but I need to ask the user to go through the picker in order to make that file available within the app (I'm using drive.file scope only).
I tried using the View.setQuery(string) api, but I'm not sure it can help.
Is it possible to set a query for a specific fileId? Is there some other way to achieve it?

Realtime drive javascript example not working - Google API

I set up the Realtime drive example shown here: https://developers.google.com/drive/realtime/realtime-quickstart
On this site: http://shuub.com
But the thing is, that when I access the link from a different browser (logged in a different Google account), it won't load the file.
All I need is to edit some plain text with another user, without needing to access a google account, it doesn't even need to be saved after closing the site. Is it possible?
Thanks for reading.
But the thing is, that when I access the link from a different browser
(logged in a different Google account), it won't load the file.
Probably you need to share the file with the other user first.
Open Google Drive in your Browser. If you did not modify the example code, your file should be located in the root folder. It's probably named "New Realtime Quickstart File". Right-click on the file and share it with the other user by adding his account to the list and granting all permissions.
All I need is to edit some plain text with another user, without
needing to access a google account, it doesn't even need to be saved
after closing the site. Is it possible?
The website you have linked is not reachable so I don't know what you want to do exactly.
Probably you could also use other and (in that use case without saving and login) simpler techniques like Mozillas TogetherJS (you can try it on jsfiddle.net) or you could use a tool like Etherpad.

Google Docs Viewer - File Request Timeout

I'm working on a Joomla website, which has a set of documents that needs to displayed using a Google Docs viewer.
Though only Authenticated users can reach the file, but the file can also be access through direct path like http://www.example.com/files/somefile.pdf even without authentication.
So when i tried to view a file through Google Viewer with a link something like this..
http://docs.google.com/viewer?url=http://www.example.com/files/somefile.pdf
The files which are of size less than 100kb are viewable and for rest all an error message is displayed as:
Sorry, it took too long to find the document at the original source. Please try again later.
You can also try to download the original document by clicking here.
So I'm not sure whether this is something to do with the Google Doc Viewer, Joomla or any Server issue for request timeout.
How can I make each file irrespective of size viewable with Google Docs?
If its PDF only, you can also just use pdfjs from Mozilla directly. Then you should check your URL encoding. If the issue remains, check out https://code.google.com/p/google-api-php-client/ for converting your docs in-place. Opening them with pdfjs is still recommended to bypass Google-Doc-Viewer problems, at least that is how I could get this working properly.

IMDB Poster URL Returns Referral Denied

In my Ruby on Rails app, I use the imdb gem (https://rubygems.org/gems/imdb) to search for a movie by title and grab the poster url and add it to the movie model I have in my database. Then in my view, I put that url in an image source tag and display the image to the user.
I don't have any problems when I'm running my application locally, but when I deploy it to Heroku, sometimes a few images are rendered successfully but for the most part, they aren't displayed properly. I've tried multiple browsers and as it turns out when I try to load the image, I get a "Referral Denied" message saying:
You don't have permission to access "[poster url here]" on this server. Reference #[some ref. number here]
How would I go about fixing this? I'm guessing it's because the IMDB server is denying my access because either I'm making too many requests from my application or because my application doesn't have the necessary credentials to get the data or maybe some combination of both. Is there a way to bypass this at all?
IMDB blocks the direct linking of images from their site on other sites, I think this previous question covers the topic.
The easiest way to get around this is to download the image and host it yourself rather than linking IMDB's copy. Alternatively you could investigate alternative movie DBs to see if they can offer what you want - the answers to this question on IMDB APIs lists a few. The Movie DB API looks like a good bet.

Resources