谷歌管理SDK错误-没有找到方法



我正在尝试使用谷歌服务帐户从我的谷歌域获得用户。

但是会抛出错误。

错误:

   Method not found: 'Boolean             
   Google.Apis.Auth.OAuth2.Responses.TokenResponse.IsExpired(Google.Apis.Util.IClock)'.
代码:

        string path = KeyPath;
        X509Certificate2 certificate = new X509Certificate2(
            path,
            "notasecret", X509KeyStorageFlags.Exportable);
        ServiceAccountCredential credential = new ServiceAccountCredential(
           new ServiceAccountCredential.Initializer("x@developer.gserviceaccount.com")
           {
               Scopes = new[] { DirectoryService.Scope.AdminDirectoryGroupReadonly, DirectoryService.Scope.AdminDirectoryGroupMemberReadonly, DirectoryService.Scope.AdminDirectoryUserReadonly },
               User = "admin@mydomain.com"
           }.FromCertificate(certificate));

        var service = new DirectoryService(new BaseClientService.Initializer()
        {
            HttpClientInitializer = credential,
            ApplicationName = "cavinHR",
        });
        service.Users.List().Domain = "mydomain.com";
        Users results = service.Users.List().Execute();

我在这行收到这个错误

        **Users results = service.Users.List().Execute();**

该错误通常意味着运行脚本的机器上的时钟不正确。检查一下,然后再试一次。当涉及到时间是否正确时,Google Authentication是非常挑剔的。

相关内容

  • 没有找到相关文章

最新更新