This code runs fine with the scope "https://www.googleapis.com/auth/drive"
File folderEntry = drive.files().get("XXXXj0_srDPPGUEtHaVYtZFljMEk").execute();
String driveQuery = "title = '" + "test" + "' and mimeType = 'application/vnd.google-apps.folder' and ";
driveQuery += "'" + folderEntry.getId() + "' in parents";
Files.List request = drive.files().list();
request.setQ(driveQuery);
FileList files = request.execute();
But if I change the scope to "https://www.googleapis.com/auth/drive.file" in the credentials, and in the API Client access panel, an error 500 is thrown.
500 Internal Server Error { "code" : 500, "errors" : [ {
"domain" : "global",
"message" : "Internal Error",
"reason" : "internalError" } ], "message" : "Internal Error" }
I am using a service account and the parent folder was created by the application.
I do not understand why I cannot perform this query.