1

使用 Google Drive API,我可以使用 OAuth2.0 初始化 DriveService 对象,但不知道如何初始化 Google Provisioning API 的 AppsService 对象以与域组和用户一起使用。我试过了

AppsService _appService = new AppsService("DOMAINNAME", "AuthenticationTokenFromDriveServiceObj");

但是,得到“无效令牌”异常。

  1. 看起来 Google Provisioning API 仍然无法处理 Google Drive API。我在这里正确吗?
  2. Google 是否已弃用 Google 配置 API?参考链接https://developers.google.com/google-apps/admin-api-deprecation-list

编辑:

我从以下给出的代码中获取 Drive 服务对象: https ://developers.google.com/drive/delegation#instantiate_a_drive_service_object [在这里,我还尝试添加配置 API 范围] 然后

PermissionList permissions = _DriveSevice.Permissions.List("root").Fetch();
string userName = permissions.Items[0].Name;
string authenticationToken = auth.State.AccessToken;
AppsService _AppService = new AppsService("DOMAINNAME", authenticationToken);
_AppsService.RetrieveAllUsers(); //This statement errors out
4

2 回答 2

0

您只需将 setOauth2Credentials 与用于在您的应用服务实例上实例化您的 Drive 实例的 Oauth2 凭据一起使用,当然前提是您的令牌对 Drive 和 Provisioning API 的范围有效。

以下是供应 API 的 Oauth2 范围

于 2012-12-10T18:20:32.477 回答
-2

Drive API 和 Provisioning API 的范围不同,不能共享 OAuth 凭据。您需要单独完成 Provisioning API 的 OAuth 流程,它们是完全不相关的 API。

Provisioning API 尚未被弃用。该列表适用于受弃用政策约束的 API,该政策发布在https://developers.google.com/google-apps/admin-api-terms

于 2012-12-10T17:18:13.867 回答