Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google drive - drive.file scope is restricting my access to a shared file

In my application, I am using 'drive.file' scope for Google Drive access from the user. I share few files in google drive amongst the users that are created by my application. Now, once a file is shared with a user, the file is not accessible to that user because of "drive.file" scope saying '404 file not found' error. But when I replace the scope with full Drive access, the file is accessible. So is their a way I can use the restrictive scope as well as retrieve/access the shared files amongst the users of my application?

like image 212
Sanket Dige Avatar asked Nov 08 '22 01:11

Sanket Dige


1 Answers

Opening a file shared to user may need auth/drive full authorization, as stated in the related SO post, Access to all files on a user's Google Drive , and Google Drive api scope and file access (drive vs drive.files) , "to be precise the Drive API gives access to Files created by the app and files that the user has opened with the app from the Drive UI (through open-with)." You can try using https://www.googleapis.com/auth/drive.readonly if you just need to view file metadata and file content. Hope this helps.

like image 190
Mr.Rebot Avatar answered Nov 14 '22 21:11

Mr.Rebot