如何使用服务帐户 json 访问 Google 目录 API
How can I access Google Directory API using service account json
我有一个服务帐户密钥 json 文件,如下所示:
{
"type": "service_account",
"project_id": "project-id",
"private_key_id": "key-id",
"private_key": "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n",
"client_email": "service-account-email",
"client_id": "client-id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account-email"
}
如何访问 Google 目录 API:
https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/list
使用服务帐户密钥 json 文件使用 python。
要使用服务帐户访问目录 API,您必须使用全域委派。有关详细信息,请参阅 Perform Google Workspace Domain-Wide Delegation of Authority。
我有一个服务帐户密钥 json 文件,如下所示:
{
"type": "service_account",
"project_id": "project-id",
"private_key_id": "key-id",
"private_key": "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n",
"client_email": "service-account-email",
"client_id": "client-id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account-email"
}
如何访问 Google 目录 API: https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/list
使用服务帐户密钥 json 文件使用 python。
要使用服务帐户访问目录 API,您必须使用全域委派。有关详细信息,请参阅 Perform Google Workspace Domain-Wide Delegation of Authority。