The user does not have sufficient permissions for this file. Google drive JS API

Viewed 4818

I saw couple questions like mine, but they were about different Google services. My problem with google drive.

It's weird. Might be some small letters in documentation, but I didn't find it.

I have public shared folder on drive (checked! without login I can view files and folders and photos)

Trying to query (using JS API) more then One folder ID, and getting this error - The user does not have sufficient permissions for this file.

If I query only one folder ID, it works good.

Here is a real example:

gapi.load('client', function(){
        gapi.client.load('drive', 'v3', function(){
            gapi.client.init({
                clientId: '1051020924675-59qgl58th06ft9s160cnp28j7a3uunte.apps.googleusercontent.com',
                discoveryDocs: ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest'],
                scope: 'https://www.googleapis.com/auth/drive.readonly',
                apiKey: 'AIzaSyDDkKdDATJQLaIkn47lUe2khAHOQ2SslUE'
            }
            ).then(function(){
                gapi.client.drive.files.list({
                            'q'         : "('0B3vR4cBcxn4oOF83RjBSeUplWEE' in parents or '0B3vR4cBcxn4oRnhSckV0dks3c2c' in parents)",
                            'pageSize'  : 10,
                            'fields'    : "nextPageToken, files(id, name, webContentLink, folderColorRgb, thumbnailLink, description)",
                            'orderBy'   : 'modifiedTime desc',
                        }).then(function(respo){console.log(respo)})
            })
        })


    })

This query will work on any account: (but will return only content of current folders ID)

'q' : "'0B3vR4cBcxn4oOF83RjBSeUplWEE' in parents",

But this - only on owner account: (and will return both folders content)

'q' : "('0B3vR4cBcxn4oOF83RjBSeUplWEE' in parents or '0B3vR4cBcxn4oRnhSckV0dks3c2c' in parents)",

I'm trying to figure out if there are any limitation for such use?

I want to get multiple folders content without asking user to login with his account on public shared folder.

0 Answers
Related