SOLVED Upcoming changes to Google Drive API

Operating System & Version
CENTOS 7.9 virtuozzo [host]
cPanel & WHM Version
v96.0.15

Lune34

Registered
Aug 11, 2021
2
1
1
France
cPanel Access Level
Root Administrator
Hello

This morning I received an email from Google Drive informing me of upcoming changes to their API. They say that I am affected because one of my "projects" uses the API. The "project" in question is of course the one that WHM uses to send my backups to my GoogleDrive. I set it up several years ago and I can't remember the details but it must have been this process that I did: How to Configure Google Drive as a Backup Additional Destination | cPanel & WHM Documentation

The email from Google informs me that I must take action before September 13th 2021.

Are you aware of these changes?
What action is needed for WHM users please?

Thanks in advance. :)


Here is the email:

___________________________

Subject: [Action Required] Drive API requires updates to your code before Sep 13, 2021
Date sent: 11th August 2021


Hello Google Drive Developer,

We have identified you as a Developer who has used the Drive API in the last 30 days. We are writing to let you know that on September 13, 2021, Drive will apply a security update that will change the links used to share some files, and may lead to some new file access requests. Access to files won’t change for people who have already viewed or modified these files.

Please update your code as detailed below before September 13, 2021, to avoid failing requests.


What do I need to know?
Items that have a Drive API permission with type=domain or type=anyone, where withLink=true (v2) or allowFileDiscovery=false (v3), will be affected by this security update.

In addition to the item ID, your application may now also need a resource key to access these items. Without a resource key, requests for these items may result in a 404 Not Found error (See below for details). Note that access to items that are directly shared with the user or group are not affected.

Will this change affect me?
If your application uses the Drive API to access files which have been shared with a user through link sharing, your application may be affected by this change.

What do I need to do?
To avoid errors accessing files, you must update your code for accessing files to include the appropriate resource keys. Details on how to do this for each of the affected Drive APIs is included below:

Changes to the Drive API
The resource key of an item is returned on the resourceKey field of the file metadata in the Drive API response.

  • If the file is a shortcut file, then the resource key for the target of the shortcut can be read from the shortcutDetails.targetResourceKey field of the same resource.
  • URL type fields such as exportLinks, webContentLink, and webViewLink will include the resourceKey.
  • Requests to the Drive API can specify one or more resource keys with the X-Goog-Drive-Resource-Keys HTTP request header.
Learn more about this change from the Drive API guide.

Changes to Apps Script
The DriveApp from Apps Script has been updated to return the resource key of a file or folder with the getResourceKey method.

  • Note: When fetching a file or folder, the resource key can be specified on the getFileByIdAndResourceKey or getFolderByIdAndResourceKey methods.
Changes to Drive UI Integrations
If your application is integrated with the Drive UI to create or open items, it will receive resource keys when your application is invoked from the Drive UI.

  • The state information for a New URL will contain folderResourceKey, which is the resource key of the folder where the new item should be created.
  • The state for an Open URL will contain a mapping of file ID to resource key in the resourceKeys field.
Learn more about integrating with the Drive UI on our website.

Which projects may be affected?
Your projects that have used the Drive API in the last 30 days and may be affected by this change are below:

  • Name and link of my project
To get help with these changes, see the Drive API support options on our website.

Thanks for choosing Drive API.

Sincerely,

The Google Drive Team
________________________________________________________________________________________________________________
 
Last edited by a moderator:

kgs

Member
Dec 15, 2020
22
2
3
USA
cPanel Access Level
Root Administrator
Howdy! I use Google Drive as our nightly backup destination. Running CENTOS 7.9 virtuozzo [server] v96.0.15.

I received the following notice from Google. Is there anything that I need to do? Thanks!

---

Hello Google Drive Developer,

We have identified you as a Developer who has used the Drive API in the last 30 days. We are writing to let you know that on September 13, 2021, Drive will apply a security update that will change the links used to share some files, and may lead to some new file access requests. Access to files won’t change for people who have already viewed or modified these files.

Please update your code as detailed below before September 13, 2021, to avoid failing requests.


What do I need to know?

Items that have a Drive API permission with type=domain or type=anyone, where withLink=true (v2) or allowFileDiscovery=false (v3), will be affected by this security update.

In addition to the item ID, your application may now also need a resource key to access these items. Without a resource key, requests for these items may result in a 404 Not Found error (See below for details). Note that access to items that are directly shared with the user or group are not affected.

Will this change affect me?

If your application uses the Drive API to access files which have been shared with a user through link sharing, your application may be affected by this change.

What do I need to do?

To avoid errors accessing files, you must update your code for accessing files to include the appropriate resource keys. Details on how to do this for each of the affected Drive APIs is included below:

Changes to the Drive API

The resource key of an item is returned on the resourceKey field of the file metadata in the Drive API response.
  • If the file is a shortcut file, then the resource key for the target of the shortcut can be read from the shortcutDetails.targetResourceKey field of the same resource.
  • URL type fields such as exportLinks, webContentLink, and webViewLink will include the resourceKey.
  • Requests to the Drive API can specify one or more resource keys with the X-Goog-Drive-Resource-Keys HTTP request header.
Learn more about this change from the Drive API guide.

Changes to Apps Script

The DriveApp from Apps Script has been updated to return the resource key of a file or folder with the getResourceKey method.
  • Note: When fetching a file or folder, the resource key can be specified on the getFileByIdAndResourceKey or getFolderByIdAndResourceKey methods.
Changes to Drive UI Integrations

If your application is integrated with the Drive UI to create or open items, it will receive resource keys when your application is invoked from the Drive UI.
  • The state information for a New URL will contain folderResourceKey, which is the resource key of the folder where the new item should be created.
  • The state for an Open URL will contain a mapping of file ID to resource key in the resourceKeys field.
Learn more about integrating with the Drive UI on our website.