Google云端硬盘API权限不足:请求的身份验证范围不足 [英] Google Drive API Insufficient Permission: Request had insufficient authentication scopes

查看:116
本文介绍了Google云端硬盘API权限不足:请求的身份验证范围不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功完成了快速入门,显示此处:

I successfully completed the quickstart shows HERE:

https://developers.google.com/drive/api/v3/quickstart/python

我想走得更远,开始上传文件和文件夹.为此,我将范围替换为:SCOPES = ['https://www.googleapis.com/auth/drive']

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']

我也将执行方式替换为

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()

然后我得到一个错误:googleapiclient.errors.HttpError:< HttpError 403,当请求 https://www时.googleapis.com/drive/v3/files?alt=json 返回权限不足:请求的身份验证范围不足.">

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.">

请帮助

推荐答案

看起来您的范围可能不正确,请替换为以下内容:

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']

SCOPES = ['https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/drive']

这篇关于Google云端硬盘API权限不足:请求的身份验证范围不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆