google-apps-script - 通过 Apps 脚本访问 Google Classroom 中的监护人信息
问题描述
我正在尝试使用课堂服务访问 Google Apps 脚本中的 Google Classroom Guardian 信息。我已经在 API 控制台中添加了服务并启用了 API。我可以访问一些数据(例如课程),但是当我尝试通过Classroom.UserProfiles.Guardians.list(student_id )
if 失败并出现权限错误来获取监护人信息时。但是,如果我添加一个(虚拟)调用,Classroom.UserProfiles.GuardianInvitations.create()
则会弹出具有所需范围的身份验证屏幕,然后脚本就可以工作了。是否有我遗漏的东西,或者这是Apps Scripts中的错误?
解决方案
尝试添加
https://www.googleapis.com/auth/classroom.guardianlinks.students
到manifest.json
文件中的范围,如下所示:
{
...
"oauthScopes": [
"https://www.googleapis.com/auth/classroom.guardianlinks.students`"
],
...
}
唯一的问题是您不会出现同意弹出窗口,并且您必须在manifest.json
.
另一种解决方案是在注释中编写一个使用此范围的函数(对不起,但您需要搜索这个),因为您描述了您的问题,它看起来像一个错误。但是我给你的解决方案应该有效。
参考
推荐阅读
- c# - Mongodb使用.net core 2.2连接错误
- css - 如何消除孩子之间的垂直差距
- activemq - 一个 MQTT 订阅者可以同时接收同一主题的多条消息吗?
- ruby-on-rails - Ruby On Rails 设计:如何在注册期间避免电子邮件唯一性验证并重写以检查它是否只有在角色“X”时才唯一
- url-rewriting - 网址重写规则不重定向
- bash - 如何按列号过滤这些数据?
- angular - 在 Angular 7 中导入 html-/ts-file
- node.js - express 和 http 服务器的使用一起
- database - 如何知道其他表中引用的父表列
- hadoop - What is the complete list of streaming command line options possible for Hadoop YARN version?