亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Gsuite Classroom Api 無法添加學生和教師

Gsuite Classroom Api 無法添加學生和教師

ibeautiful 2022-11-18 20:43:33
我正在我的域中實施谷歌的課堂 api。正如我正在創建課程的文檔所建議的那樣。我已經創建了一個服務帳戶并為該帳戶分配了必要的范圍,并且我使用管理員帳戶作為委托帳戶。該文件指出管理員可以直接創建課程,我的課程創建系統正在運行。它還說管理員可以直接添加教師和學生。當我嘗試將學生或教師添加到課程時,它會拋出一個錯誤Request had insufficient authentication scopes,但我可以從此鏈接獲得正確的課堂范圍。我錯過了什么嗎?任何建議將不勝感激。service_credentials = ServiceAccountCredentials.from_p12_keyfile('aServiceAccount.iam.gserviceaccount.com', '*.p12', 'notasecret',scopes=['https://www.googleapis.com/auth/admin.directory.user','https://www.googleapis.com/auth/classroom.courses', 'https://www.googleapis.com/auth/calendar'])credentials = service_credentials.create_delegated(            'anAdmin@domain')class_service = build('classroom', 'v1',                              credentials=credentials)directory_service = build('admin', 'directory_v1',                                  credentials=credentials)calendar_service = build('calendar', 'v3',                                 credentials=credentials)course = {            'name': 'This is dummy course',            'section': 'dummy section',            'descriptionHeading': 'Dummy course',            'courseState': 'ACTIVE',            'ownerId': 'anAdmin@domain' # also in the teachers group        }response = class_service.courses().create(body=course).execute()course_id = response.get('id')course_code = response.get('enrollmentCode')teacher = {'userId': 'anotherUserFromTeachersGroup@domain'}class_service.courses().teachers().create(courseId=course_id,body=teacher).execute()        # error : Request had insufficient authentication scopesstudent = {'userId': 'user@domain'}class_service.courses().students().create(            courseId=course_id, enrollmentCode=course_code, body=student).execute()        # error : Request had insufficient authentication scopes
查看完整描述

1 回答

?
千巷貓影

TA貢獻1829條經驗 獲得超7個贊

您必須確保https://www.googleapis.com/auth/classroom.rosters此范圍存在于您的域范圍委托和您的請求范圍中。 關聯


查看完整回答
反對 回復 2022-11-18
  • 1 回答
  • 0 關注
  • 102 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號