I am trying to delete permissions on a specific file in Google Drive using Google Drive API and Google Apps Script with a service account.
My mission is to delete permission of a file which is shared with the option "public on the web".
Things I have done so far:
- Created a service account with domain-wide delegation.
I have included following scopes in admin.google.com
https://www.google.com/m8/feeds
https://www.googleapis.com/auth/admin.reports.audit.readonly
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/script.external_request
error log:
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Insufficient permissions for this file",
"locationType": "other",
"location": "file.permissions"
}
],
"code": 403,
"message": "Insufficient permissions for this file"
}
}