Error 500 when performing a query with drive.file scope

前端 未结 2 1448
日久生厌
日久生厌 2021-01-23 17:02

This code runs fine with the scope \"https://www.googleapis.com/auth/drive\"

File folderEntry = drive.files().get(\"XXXXj0_srDPPGUEtHaVYtZFljMEk\").execute();
St         


        
相关标签:
2条回答
  • 2021-01-23 17:35

    I too get the same error. However this workaround does get all the children of a folder I created, until google fixes the query issue I suppose.

    ChildList list = service.children().list(FILEID).execute();
    
    0 讨论(0)
  • 2021-01-23 17:38

    This may be a bit late but... I believe the problem occurs because when you run with the scope https://www.googleapis.com/auth/drive.file you are only allowed to see the files your app has created. However, your query may potentially return metadata that are outside your auth scope.

    I had the same problem as well and manage to fix it by adding the DRIVE_METADATA_READONLY scope:

    credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE_FILE, **DriveScopes.DRIVE_METADATA_READONLY**);
    
    0 讨论(0)
提交回复
热议问题