我正在尝试构建一个 Google Classroom 扩展,让用户可以控制何时接收“工作即将到期”通知。但是,当令牌刷新时,我收到此错误:“引发异常。RefreshError(google.auth.exceptions.RefreshError:授权服务器未授予所有请求的范围,缺少范围https://www.googleapis.com/auth /classroom.coursework.me.readonly。”
所使用的代码直接来自谷歌教室的谷歌授权页面
SCOPES = ['https://www.googleapis.com/auth/classroom.courses.readonly', 'https://www.googleapis.com/auth/classroom.coursework.me.readonly']
def main():
"""Shows basic usage of the Classroom API.
Prints the names of the first 10 courses the user has access to.
"""
creds = None
# The file token.json stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.json'):
creds = Credentials.from_authorized_user_file('token.json', SCOPES)
# If there are no (valid) credentials available, let …Run Code Online (Sandbox Code Playgroud)