Reputation: 7294
I'm trying to create a nodejs app that can ready my GoogleDrive files. I don't want an app that everyone can use, it's only specific to my GoogleDrive. so no need for OAuth...
I've created an api key for GoogleDrive, in the console without any restrictions.
This is the call that I'm doing: https://www.googleapis.com/drive/v3/files?pageSize=10&fields=nextPageToken&key=MY_KEY
When using this key I get this error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientFilePermissions",
"message": "The user does not have sufficient permissions for this file."
}
],
"code": 403,
"message": "The user does not have sufficient permissions for this file."
}
}
Is this even possible in GoogleDrive?
Do I have to set permissions somewhere?
What am I missing here?
Upvotes: 1
Views: 703
Reputation: 201703
How about this answer?
The API key is used for the publicly shared contents. So if you try to access to the file which is not shared publicly with the API key, an error occurs even if the file is yours.
And, API key can be used for GET method. The API key cannot be used for POST and PUT methods. Please be careful this.
In order to access to your file on Google Drive, how about the following methods?
Publicly share the file, and you access to the file with the API key.
If you want to access the file without sharing publicly, how about using the access token retrieved by the Service account or OAuth2?
Upvotes: 1