google-apigoogle-drive-apigoogle-api-client

Google Drive api scope and file access (drive vs drive.files)


I have created two refresh tokens for me: one for

SCOPE = 'https://www.googleapis.com/auth/drive'

and another

SCOPE = 'https://www.googleapis.com/auth/drive.file'

I'm trying to get information about files (using get method) Some files I can get when using SCOPE drive.files, and some only when using wider scope drive

But I can not figure out what is the reason for that? Files are located in different folders but have one shared root folder.


Solution

  • The difference is that 'drive.file' only gives you permission to files that your app has created or the user has explicitly shared with your app, whereas 'drive' gives your app permission to see the all the files in the user's drive.

    See

    https://developers.google.com/drive/web/scopes