googlearchive / drive-android-quickstart

[MOVED] Quickstart application showing the Google Drive API for Android
https://github.com/gsuitedevs/android-samples
Apache License 2.0
238 stars 159 forks source link

Access to the whole Drive not allowed #18

Open mvysny opened 6 years ago

mvysny commented 6 years ago

I'm trying to use this API to access all files on user's Drive, but it is not possible:

  1. Using Drive.SCOPE_FILE only lists New Folder as a child of the root folder (client.rootFolder)
  2. Using just Scope("https://www.googleapis.com/auth/drive.readonly") fails with:
    java.lang.IllegalArgumentException: You must request a Drive scope in order to interact with the Drive API.
       at com.google.android.gms.common.internal.zzbq.checkArgument(Unknown Source)
       at com.google.android.gms.drive.Drive.zza(Unknown Source)
       at com.google.android.gms.drive.Drive.getDriveResourceClient(Unknown Source)
  3. Using both scopes: requestScopes(Drive.SCOPE_FILE, Scope("https://www.googleapis.com/auth/drive.readonly")) seems to ignore the latter one and still only lists the New Folder
mvysny commented 6 years ago
  1. Passing the scope of https://www.googleapis.com/auth/drive (the full access rights) fails with an exception:
    E/ClientConnectOperation: Handling authorization failure
                                                          nzh: Authorization failed: Unsupported scope: https://www.googleapis.com/auth/drive
                                                              at nzl.a(:com.google.android.gms@11951448:25)
                                                              at nvy.<init>(:com.google.android.gms@11951448:26)
                                                              at nxh.a(:com.google.android.gms@11951448:72)
                                                              at swi.run(:com.google.android.gms@11951448:11)
                                                              at mvc.run(:com.google.android.gms@11951448:26)
                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                              at nak.run(:com.google.android.gms@11951448)
                                                              at java.lang.Thread.run(Thread.java:761)

    Is there a way to access all files in user's Google Drive with this API?