使用Python中的目录API创建组

2024-10-03 02:37:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用directoryapi创建组和邮件列表,但似乎有什么问题。我使用了Python Quickstart中的代码,它工作得很好。但是,当我试图将作用域更改为:https://www.googleapis.com/auth/admin.directory.group.member以便创建或访问组时,我遇到了以下错误:

https://www.googleapis.com/admin/directory/v1/users?customer=my_customer&orderBy=email&alt=json&maxResults=10 returned "Insufficient Permission: Request had insufficient authentication scopes.">

你知道我怎么解决这个问题吗?在


Tags: 代码httpscomauth列表adminwwwgroup
1条回答
网友
1楼 · 发布于 2024-10-03 02:37:14

获取用户列表,如

results = service.users().list(customer='my_customer',maxResults=10,orderBy='email').execute()

您需要admin.directory.user作用域。 如果要列出用户,则需要在SCOPES列表中包含正确的范围。如果不这样做,删除这行应该可以修复这个错误。不过,示例的其余部分确实依赖于这一行。在

相关问题 更多 >