Access Google Photos through Google Drive is not working - google-drive-api

We've been using Google Drive to fetch Google Photos metadata and to access photos through the following url
https://drive.google.com/thumbnail?authuser=0&sz="size"&id="photoId"
with the correct access token.
Metadata continues to work and drive url is giving a 404 http error (not found).
It was working ok, until some days ago (i.e. we first noticed it 2017/12/14). Probably this is related with changes going on with drive.
Is this an expected behaviour? What is the correct API to access Photos now?

You may refer with this thread. Try to clear your cookies and cache, use an incognito/private window, disable all browser extensions/add-ons/plug-ins and/or try a different browser to see if this is a browser related issue.

this is happening in production on an iOS app and we do have multiple users complaining every day.
As a test case we did the following:
1 - go to Google Photos app and did check the option to show photos & videos in Google Drive;
2 - try to clear safari history;
3 - login again.
The result is the following:
1 - we do have success requesting several pages with photo-metadata through Google Drive api v3;
2 - Through the id that we get for each photo we do try to request an image for a specific size through
https://drive.google.com/thumbnail?authuser=0&sz="size"&id="photoId"
Step 2 fails with a http 404 and did not change nothing on our side. It is happening in all devices that we tested, which means that something changed or is not working properly with drive.
Meanwhile we've been told by someone (not Google) that Google Drive is no longer the best way to access Google Photos. Because this data source is in our product, it is important to know what is the correct / best api to access Google Photos now.

Related

How to generate a google drive link with token for a session per user?

I frequently share content around on google drive from a site - problem - users bookmark the drive link and share it around which beats the point and hardwork put into the webpage itself.
Question:
How do I create a link that works such that when a user goes through it the link is available for that user only - or for x amount of time (lets says 4 days)
So that even if its bookmarked it wont work, and the user needs to visit the page back again to get a link.
Can't seem to find any tutorials that can get this to work.
You cant Creating a link on google drive makes it available to anyone who has the link.
It is possible to share it with just one person in the web view of Google drive. I have not been able to get this to work with the api though sharing
The closest i have come is sharing the file directly to a user which isnt the same thing as giving them a temp link manage sharing

403 error from Google Drive direct link due to multiple accounts logged in

I have a number of images in Google Drive and I am wanting to use them in various ways via the direct link style:
https://drive.google.com/uc?id=DOCID
In Chrome I am logged into three different Google accounts, my corporate one, my personal one, and one other. If I navigate through the Google Drive interface to my files in the corporate account I can see them fine. If I use the form https://drive.google.com/open?id=DOCID then the Google Drive interface opens properly with the image displayed. However, when I try to access the file directly using the uc?id= URL style above I get a 403 error.
"403. That’s an error.
We're sorry, but you do not have access to this page. That’s all we know."
I have tracked this down to being because when I use this URL form, for some reason Chrome or Google Drive are using the wrong authentication credentials - i.e. the ones from my personal account even though this file is in my corporate account.
I've proved this by firing up Firefox, which isn't authenticated to any account, logging in as my corporate user, and then using the URL above: bingo, the image is displayed.
So my question: is there any way to force the URL style above to use the correct set of credentials when accessing the file?
You can use drive.google.com/u/1/uc?id=DOCID or drive.google.com/a/mycorporatedomain.com/uc?id=DOCID
However, do not rely on these URL's not changing in the future.
Log out of all the accounts and only log in just one needed account. This works for me. The google free 15 GB is good since I can always create new email but difficulty in downloading file give drop box an edge.

Google drive preview "/image" API doesn't work anymore?

Few days ago I was able to make request to:
https://drive.google.com/a/{{domain}}/file/d/{{docDriveId}}/image?pagenumber=1&w=400
Via this API I was able to get image preview on multi-page documents.
Seems it's there, but times-out after some time. It doesn't work anymore. Does anyone know what happened? It seems there's no documentation on this API.
On the other hand, I am aware of the thumbnailLink URL when getting document object via API, but this will only get 1st page preview.
Any alternative solutions to this?
Thanks a lot,
M
That URL is not a part of the official Drive API and is not guaranteed to remain stable. The Drive API doesn't include the ability to fetch per-page image previews of documents, but you may want to investigate using the embedLink as an alternative: https://developers.google.com/drive/v2/reference/files

Conditions of using webContentLink?

Which kind of cookie is required to work with webContentLink? I noticed when I'm logged in to Gmail only, i get 403 error. When I open Google Drive too in on other tab and check some files, then my webContentLinks starts to work. Is this the way it should work or did I missed something? Once it was sufficient to be logged in only in Gmail...
(I have a very simple web application, that shows some links to files I shared with my friends in Google Drive. I don't want to use further authentication, but public is also not an option. It was very convenient to have accessible links when their Gmail is opened.)

Launching the Google Drive sharing dialog in an app. What should be the APP_ID value?

I'm following this article, trying to add a sharing dialog in a web app.
I got the button working in opening the modal popup, but it just prints this error in the console:
Refused to display 'https://drive.google.com/share?id=SOME_LONG_ID&foreignService=explorer&shareService=explorer&shareProtocolVersion=2&command=init&subapp=10&popupWindowsEnabled=true&shareUiType=default&rand=1386925457304&theme=2&client=postMessage&appId=MY_APP_ID&embedOrigin=http%3A%2F%2Fmy_app.appspot.com'
in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
And the modal itself just shows the message "Sorry, sharing is unavailable at this time. Please try again later."
For the checklist at the bottom of the article:
The user is signed in to Google True
The user has installed your app False How do I ask them to install?
The URL of the page that launches the dialog must have the same origin as the Open URL registered for the app. True
So I have 2 questions:
How do I ask them to install my app? It's supposed to be a web app, where there's 1 button to select Drive files via the Picker API (which is now working), and then another button which will sow this Drive sharing dialog to set the permissions of the selected files. There's no need for installation. Will it work for this setup?
What should be the value for the APP_ID? I'm guessing it's the ID in the "Drive SDK" section of the Cloud Console? The console is so confusing and there's so many values for keys, ids, etc. that I have no idea which to use. Here's a screenshot of what I mean by the ID and what I'm trying to use.
(1) Installing means you have to get the user to accept the drive.install scope - instructions here. This will integrate your app with the "open with" menu in Google Drive. But before that can work you will need to tell the Google Cloud Console what url to go to when the user clicks "open" - more instructions. In your case, since you don't actually want to allow the user to open files from Drive you won't be defining any file types, so in reality there won't actually be any visible integration with Drive.
Note that the share dialog will only work on the one page which has the url you specify as the target for "open" (the instructions say this and from experience it seems to be true).
(2) Client ID You can find this in the Google Cloud Console - see above. Mine is a 12 digit number, so yours will probably be too.
I had the same problem. The iFrame error shows up when you call setItemIds if your app_id is wrong. No idea why. Anyway, it started working for me when I used the right app_id -- the one that shows up like in your screenshot.