但是,我需要获得相同的结果,但作为具有管理员权限且无需用户登录和应用批准的“后端服务”,这可能吗?
您正在寻找的是service accounts。使用服务帐户,您可以代表域中的用户访问数据,这有时被称为“委派域范围的权限”。幸运的是,您可以将它用于 Google Apps for Work。
如果您拥有 Google Apps 域 - 如果您使用 Google Apps for Work,则
示例 — Google Apps 域的管理员可以授权
代表 Google Apps 中的用户访问用户数据的应用程序
领域。例如,使用 Google Calendar API 的应用程序
将事件添加到 Google Apps 域中所有用户的日历
将使用服务帐户访问 Google Calendar API
代表用户
这里是using a P12 file时使用Python的sn-p:
from oauth2client.service_account import ServiceAccountCredentials
client_email = '123456789000-abc123def456@developer.gserviceaccount.com'
scopes = ['https://www.googleapis.com/auth/sqlservice.admin']
credentials = ServiceAccountCredentials.from_p12_keyfile(
client_email, '/path/to/keyfile.p12', scopes=scopes)
Retrieving all calendar resources
要检索与特定日历关联的资源条目的第一页,请将以正斜杠结尾的 HTTP GET 请求发送到资源馈送 URL。包括Authenticating中描述的Authorization标头。
GET https://apps-apis.google.com/a/feeds/calendar/resource/2.0/{domain name}/
(可选)您可以向资源馈送 URL 发送 HTTP GET 请求,其中 start 参数为空字符串。
GET https://apps-apis.google.com/a/feeds/calendar/resource/2.0/{domain name}/?start=""