2
votes

Some data will be lost after Google Drive API Re-authorization (drive.files.list)

My steps

  1. Create 4 folders using API
drive.files.list
[
   {id:'XXXX1', name:'folder1'},
   {id:'XXXX2', name:'folder2'},
   {id:'XXXX3', name:'folder3'},
   {id:'XXXX4', name:'folder4'},
]
  1. Cancel authorization ([disconnect from drive] in Google Drive App) enter image description here

  2. Re-authorize and then call the api

drive.files.list
[
   {id:'XXXX2', name:'folder2'},
   {id:'XXXX3', name:'folder3'},
]

I can no longer get a complete list, but if I specify a file id can return the contents of the file

drive.files.get({fileId:'XXXX1' })
{id:'XXX1', name:'file1'}

I use scope as https://www.googleapis.com/auth/drive.file

Does anyone know how to make it work?

1
TBH i would expect you to get nothing back when you disconnect the app and reconnect it and for you to need to recreate them all again. Might want to report that as a bug. - DaImTo
There are many files (1000 files) in this folder. When I reconnect, there are only a few hundred files left. It may take some time to complete the disconnect. - Moon

1 Answers

1
votes

https://www.googleapis.com/auth/drive.file Per-file access to files created or opened by the app. File authorization is granted on a per-user basis and is revoked when the user deauthorizes the app.

Drive.file is used to access files created by your app. So that you shouldn't have access to the users full drive account just the files and directories you create.

When you disconnect access to the app and then reconnect it I personally would expect everything to be gone.

I would post this over on the issue tracker it seams strange to me that only some of the data remains it should either all be there or all be gone.

https://issuetracker.google.com/issues?q=componentid:191650%2B