5

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?

ssuukk
  • 8,200
  • 7
  • 35
  • 47

1 Answers1

0

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.

seanpj
  • 6,735
  • 2
  • 33
  • 54
  • 2
    Why is it necessary to use the REST API with a native android app? Use a webview to proceed through oauth? That's horrible you lose all the native experience that you get with the other scopes... why is the scope not supported? Cant be security, since malware could just use the REST API right? – Greg Ennis Jan 07 '16 at 19:16