Nic Cottrell
Nic Cottrell

Reputation: 9685

Google Drive: What combination of scopes lets an app read existing files but not have edit/delete privileges?

I've found that with https://www.googleapis.com/auth/drive scope, my app can read all existing files (and their contents) in a Google Drive, but when I auth the app, it says that this scope can also delete files in the drive and I don't want to grant that.

I know that by itself https://www.googleapis.com/auth/drive.file only allows the app to read files created by the app itself or especially granted access.

I've tried other combinations, but can't find one where the the app can read the contents of any file I can see, but can't delete anything. This is the closest I've come:

Is there a combination that will achieve my goal?

Upvotes: 3

Views: 972

Answers (3)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117281

There isn't one if you have access to read and write to a file then you will also have access to delete that file.

Its how they have permissions setup.

enter image description here

If you don't want to upload and only download try drive readonly. scopes#drive

Upvotes: 0

Simón
Simón

Reputation: 455

If you're not intending to create any files or save any data to Drive, then you have the https://www.googleapis.com/auth/drive.readonly scope.

Note that this is a restricted scope that will grant your app with read-only access to the user's entire Drive, but it will also prevent your app from creating any new files or editing existing ones.

If you want your application to be able to access the entire Drive, and you're planning to release your app to the public, you should submit your application to a restricted scope verification and security assessment; otherwise your app will be limited to 100 users, and users will see a warning while your app is unverified.


Here's more information:

Upvotes: 0

NightEye
NightEye

Reputation: 11214

Based on your needs, you should be eyeing https://www.googleapis.com/auth/drive.readonly. This enables you to read the file metadata and content.

Allows read-only access to file metadata and file content.

Resource:

Upvotes: 1

Related Questions