C# 如何使用GoogleDrive API为域组和用户使用GoogleProvisioningAPI?

C# 如何使用GoogleDrive API为域组和用户使用GoogleProvisioningAPI?,c#,google-drive-api,google-apps,google-provisioning-api,C#,Google Drive Api,Google Apps,Google Provisioning Api,有了GoogleDriveAPI,我可以使用OAuth2.0初始化DriveService对象,但不知道如何初始化GoogleProvisioningAPI的AppsService对象以与域Gorup和用户一起工作。我试过了 AppsService_appService=新的AppsService域名,来自DriveServiceObj的AuthenticationToken 但是,获取无效令牌异常 看起来Google Provisioning API仍然无法处理Google Drive API

有了GoogleDriveAPI,我可以使用OAuth2.0初始化DriveService对象,但不知道如何初始化GoogleProvisioningAPI的AppsService对象以与域Gorup和用户一起工作。我试过了

AppsService_appService=新的AppsService域名,来自DriveServiceObj的AuthenticationToken

但是,获取无效令牌异常

看起来Google Provisioning API仍然无法处理Google Drive API。我说的对吗? 谷歌是否不赞成使用谷歌资源调配API?参考链接 编辑:

我从以下位置给出的代码中获取驱动器服务对象: [在这里,我还尝试添加配置API作用域] 然后


驱动器API和配置API的作用域不同,无法共享OAuth凭据。您需要分别通过用于配置API的OAuth流,它们是完全不相关的API


设置API尚未被弃用。该列表适用于受弃用策略约束的API,该策略发布于。

您只需使用setOauth2Credentials和Oauth2凭据,用于在应用程序服务实例上实例化驱动器实例,当然前提是您的令牌对驱动器和配置API的作用域有效


Oauth2是否是配置API的作用域

正确的说法是,它们的作用域不同,但不需要让用户通过2个身份验证工作流。在发出请求时,您只需要在两个作用域之间留出一个空格。我尝试过用空格分隔驱动器和配置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