问题
I successfully completed the quickstart shows HERE:
https://developers.google.com/drive/api/v3/quickstart/python
I wish to go further and begin to upload files and folders. To do so I have replaced the scope with: SCOPES = ['https://www.googleapis.com/auth/drive']
I have also replaced the execution with
national_parks = ['Yellowstone', 'Rocky Mountain', 'Yosemite']
for national_park in national_parks:
file_metadata = {'name': national_park,
'mimeType': 'application/vnd.google-apps.folder'
# 'parents': []
}
service.files().create(body=file_metadata).execute()
I then get an error: googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files?alt=json returned "Insufficient Permission: Request had insufficient authentication scopes.">
Help please
回答1:
Looks like your scopes might not be correct, replace with the following:
SCOPES = ['https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/drive']
回答2:
You need to change the scopes to one of the following
- https://www.googleapis.com/auth/spreadsheets
- https://www.googleapis.com/auth/drive
and delete the token.pickle file, it will then prompt you to authorize the application again this time with the required scope of permissions needed to call that method
来源:https://stackoverflow.com/questions/64508018/google-drive-api-insufficient-permission-request-had-insufficient-authenticatio