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

572 views
Skip to first unread message

Alexei Kositsin

unread,
Nov 10, 2017, 10:38:22 AM11/10/17
to Google Drive API and SDK
Hey, help needed.

I have a PUBLIC shared folder on my drive.

I need to get access to this folder for everyone using my app.

I can get folders content querying by its ID,  but when i'm trying to get more than one IDs i'm getting this error.

Didnt find any restrictions in API docs.

example for the query:

gapi.load('client', function(){
        gapi.client.load('drive', 'v3', function(){
            gapi.client.init({
                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'         : "('0B3vR4cBcxn4odWprdmc5emRoYU0' in parents or '0B3vR4cBcxn4oLW5COHlyQXF6VEU' in parents)",
                            'pageSize'  : 10,
                            'fields'    : "nextPageToken, files(id, name, webContentLink, folderColorRgb, thumbnailLink, description)",
                            'orderBy'   : 'modifiedTime desc',
                        }).then(function(respo){console.log(respo)})
            })
        })

    
    })


this will give an error: The user does not have sufficient permissions for this file.

gapi.load('client', function(){
        gapi.client.load('drive', 'v3', function(){
            gapi.client.init({
                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'         : "('0B3vR4cBcxn4odWprdmc5emRoYU0' in parents)",
                            'pageSize'  : 10,
                            'fields'    : "nextPageToken, files(id, name, webContentLink, folderColorRgb, thumbnailLink, description)",
                            'orderBy'   : 'modifiedTime desc',
                        }).then(function(respo){console.log(respo)})
            })
        })

    
    })

this will not.

again, this is a public folder.



if i'm logged with my user, i can get this query well. but with other account or winthout login I cant! ((


Please advice.

Thanks a lot!

Reply all
Reply to author
Forward
0 new messages