Search code examples
androidgoogle-drive-android-api

Google Drive scopes deprecated?


I'm writing an app that would play media straight off Google Drive.

Google docs mention

https://www.googleapis.com/auth/drive.readonly

scope (see here: https://developers.google.com/drive/web/scopes) that seems exactly to be what I need. Yet, it seems that Android drive API supports only two of scopes mentioned there:

Drive.SCOPE_FILE Drive.SCOPE_APPFOLDER

so I've tried several non-standard scopes like this:

    mGoogleApiClient = new GoogleApiClient.Builder(XenoAmp.getContext())
            .addApi(Drive.API)
            //.addApi(DriveScopes.)
            //.addScope(Drive.SCOPE_APPFOLDER)
            .addScope(Drive.SCOPE_FILE)
            .addScope(new Scope("https://www.googleapis.com/auth/drive"))
            //.addScope(new Scope("https://www.googleapis.com/auth/drive.readonly"))
            //.addScope(new Scope("https://www.googleapis.com/auth/drive.metadata.readonly"))
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this).build();

Yet my logcat complains:

03-29 12:53:58.935: E/ClientConnectionOperation(9953): com.google.android.gms.drive.auth.c: Authorization failed: Unsupported scope: https://www.googleapis.com/auth/drive

So - is drive scope no more supported? How can I get access to all user media files on Goodle Drive then?


Solution

  • Yes, the DRIVE scope is not supported in GDAA. If you need it, you have to go with the REST API. GDAA is not a 'newer' API, it is a different API. Both will be around for a while. You can compare these two here.