目前,它看起来像一个旁边没有文字的正方形,我们想要自定义外观和感觉,而不会打扰当然的图标以匹配我们的其他按钮.
已经尝试将样式添加到div
转换为共享图标的样式,但到目前为止还不成功.
<div id='widget-div' class='btn btn-blue'>Google Classroom</div>
Run Code Online (Sandbox Code Playgroud)
以上行呈现如下:
知道如何进一步或进入哪个方向?
我正在研究 Google Classroom Pub/Sub 通知。我的任务是使用 Rest API 创建发布/订阅主题和订阅。我已成功创建发布/订阅主题,但当我为创建的主题设置 IAM 策略/权限时,我收到错误消息。
API URL:- https://pubsub.googleapis.com/v1/projects/project-abc/topics/xyz-topic-101:setIamPolicy API 方法:- POST API 请求正文:-
{
"policy": {
"bindings": [
{
"role": "roles/owner",
"members": [
"abc@domain.com",
"classroom-notifications@system.gserviceaccount.com"
]
},
{
"role": "roles/pubsub.admin",
"members": [
"abc@domain.com",
"classroom-notifications@system.gserviceaccount.com"
]
},
{
"role": "roles/pubsub.editor",
"members": [
"abc@domain.com",
"classroom-notifications@system.gserviceaccount.com"
]
},
{
"role": "roles/pubsub.publisher",
"members": [
"abc@domain.com",
"classroom-notifications@system.gserviceaccount.com"
]
},
{
"role": "roles/pubsub.subscriber",
"members": [
"abc@domain.com",
"classroom-notifications@system.gserviceaccount.com"
]
}
],
"version": 1
}
}
Run Code Online (Sandbox Code Playgroud)
API 响应:- { "error": { "code": 400, …
我正在尝试制作一个与谷歌 API 交互的不和谐机器人,特别是谷歌课堂 API,因此我从谷歌控制台创建了一个新项目,并为 Web 应用程序创建了一个新的 OAuth 客户端。我也启用了 Classroom API 并选择了我想使用的所有范围:
['https://www.googleapis.com/auth/classroom.course-work.readonly',
'https://www.googleapis.com/auth/classroom.student-submissions.students.readonly',
'https://www.googleapis.com/auth/classroom.courses.readonly']
Run Code Online (Sandbox Code Playgroud)
然后我使用 Google 的示例设置了我的 python 程序(起初我使用文档编写了自己的程序,但得到了相同的结果)。当我运行示例代码时一切正常,它打开浏览器并要求我选择我的帐户,我选择我的学校帐户,当它加载时,我希望授权屏幕出现,询问我是否允许请求的数据说出了点问题,根本没有错误消息。我已经credentials.json
从谷歌仪表板下载了正确的文件夹并在我的程序中使用了它。
我还将提供我编写的简化代码,也许那里有问题。
import pickle
import os
from google_auth_oauthlib.flow import Flow, InstalledAppFlow
from googleapiclient.discovery import build
from google.auth.transport.requests import Request
CLIENTSECRETPATH = "credentials.json"
APISERVICENAME = "classroom"
APIVERSION = "v1"
SCOPES = ['https://www.googleapis.com/auth/classroom.course-work.readonly', 'https://www.googleapis.com/auth/classroom.student-submissions.students.readonly', 'https://www.googleapis.com/auth/classroom.courses.readonly']
cred = None
if os.path.exists("toke.pickle"):
with open("tiken.pickle", "rb") as token:
cred = pickle.load(token)
if not cred or not cred.valid:
if cred and cred.expired and cred.refresh_token:
cred.refresh(Request())
else: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将" 课堂共享"按钮添加到需要身份验证的资源.当在资源上单击"共享到课堂"按钮,并在"课堂"中创建分配(例如)时,缩略图,标题和URL将显示在分配的底部.
由于资源位于身份验证之后,因此将显示缩略图的登录屏幕,并显示"登录"作为链接的标题.看起来捕获缩略图和标题的服务无法访问浏览器中的用户会话.
当教师和学生看到此登录消息时,这可能会让他们感到困惑.
有办法:
A.)禁止显示缩略图/标题/ URL?
B.)以编程方式影响被捕获的内容?
C.)预测请求的来源,并使用更相关的图像/标题呈现缩略图服务?
谢谢.
我对学生的课程反应有疑问.
我没有在API调用中获取两个参数(emailAddress和photoUrl)
通过我的代码调用API" https://classroom.googleapis.com/v1/courses/ {courseId}/students" 的URL .
我收到以下回复:
{
"students": [
{
"courseId": "303431573",
"userId": "104377167089915657872",
"profile": {
"id": "104377167089915657872",
"name": {
"givenName": "student2",
"familyName": "User",
"fullName": "student2 User"
}
}
},
{
"courseId": "303431573",
"userId": "104304056850029354748",
"profile": {
"id": "104304056850029354748",
"name": {
"givenName": "student1",
"familyName": "User",
"fullName": "student1 User"
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
但是,当我通过传递相同的courseId在Google Classroom的开发者控制台中执行它时,我得到如下响应:
{
"students": [
{
"courseId": "303431573",
"userId": "104377167089915657872",
"profile": {
"id": "104377167089915657872",
"name": {
"givenName": "student2",
"familyName": "User",
"fullName": "student2 User"
},
"emailAddress": …
Run Code Online (Sandbox Code Playgroud) 信息位:
我们正在尝试为使用 Google Classroom 或 Google G-Suite for Education 的学生建立登录。本质上,单点登录系统。学生和管理员将登录,我将验证他们的电子邮件扩展名,这对他们的地区来说是唯一的,然后我会将他们放入我们系统中正确的学校。
这种将用户帐户划分为我们系统中的许可证的过程是在用户登录时即时进行的,因此在开始时不需要大量数据转储。
用户和管理员必须被路由到我们系统中的正确学校,因为管理员在我们的系统中运行报告和管理用户,并且需要具有正确的访问权限。
问题:
我不知道如何Organizational Units
从 Google 服务 api获取用户。通常,学校将组织单位作为学校,并将学生分配到这些学校。
因此,当我使用 Oauth2 对用户进行身份验证时
$googleService = new Google_Service_Oauth2($googleClient);
$info = $googleService->userinfo->get();
Run Code Online (Sandbox Code Playgroud)
这工作正常,用于获取一些基本信息,但不包括该用户的组织单位。
然后当我尝试使用Google Directory
api 时,它工作正常,但前提是用户是管理员
$directory = new Google_Service_Directory($googleClient);
$user = $directory->users->get($userId);
Run Code Online (Sandbox Code Playgroud)
因此,如果登录我的应用程序的人(主要是学生)不是管理员,那么他们将无法从Google Directory
.
主要问题:
如何获取经过身份验证的用户(不是管理员)的组织单位?
也许这对于 Google 服务来说是不可能的,但我们在其他六项服务中做到了这一点,没有任何问题。任何帮助表示赞赏。似乎无法在谷歌论坛或代码示例上找到有关此的任何信息。
我正在努力寻找一种将Google Classroom API与React-Native应用程序集成的方法。我已经阅读了 Google API 文档,但无法找到将此 api 集成到我的 React-Native 应用程序中的方法。
选项 - 1
https://developers.google.com/classroom/quickstart/js
上面是显示浏览器快速启动的链接
,但我无法将脚本标签插入我的反应本机应用程序。而且react-native不是浏览器,所以最终它不适用于react-native。所以我认为这个选项适用于网络。
选项 - 2
https://developers.google.com/classroom/quickstart/nodejs
Node.js 快速入门- 本指南说它适用于 Node.js,如果您查看集成代码,它是完整的 Node.js 代码,需要节点服务器来跑步。它仅适用于服务器端node.js,它也不起作用。
然后我搜索了任何现成的 NPM 包,但它也不适用于反应本机。没有官方的 google npm 可在 React-Native 应用程序中使用。
我还找到了一种使用 Gapi API 的方法。它不会帮助 Gapi -如何在反应中使用gapi
任何帮助将不胜感激,提前致谢:)
google-api google-api-js-client reactjs react-native google-classroom
我正在尝试构建一个 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) 我在查看 Google Classroom API 时注意到没有获得成绩的选项。我需要将 Google Classroom 中的作业成绩提取到我正在创建的外部成绩簿应用程序中。有谁知道这是否可能,或者如何做到这一点?
我已经实现了 Classroom API 的 Java QuickStart,但在运行时收到错误消息“java.io.FileNotFoundException:找不到资源:/credentials.json”。我将凭证.json 文件复制到项目 res 目录,但仍然出现此错误。有什么建议么?
google-classroom ×10
google-api ×4
python ×2
credentials ×1
google-oauth ×1
ioexception ×1
java ×1
oauth ×1
oauth-2.0 ×1
react-native ×1
reactjs ×1