Tag: google api

Google C#Api Beta 1.6身份validation问题

尝试使用C#Beta v1.6 SDK对Google日历服务进行身份validation和访问时看起来不对 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Google.Apis.Auth.OAuth2; using Google.Apis.Auth; using Google.Apis.Authentication; using Google.Apis.Calendar.v3; using System.Threading; using Google.Apis; using Google.Apis.Services; var uc = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets() { ClientId = string.Empty, ClientSecret = string.Empty }, new[] { CalendarService.Scope.Calendar }, “user”, CancellationToken.None); var service = new CalendarService(new BaseClientService.Initializer() { HttpClientInitializer = […]

您使用过Google的Directory API吗?

我正在尝试使用Google Directory API库来维护域的电子邮件地址。 最新的库是google-admin-directory_v1-rev6-csharp-1.4.0-beta。 到目前为止,我得到的最好和最远的是收到403错误(未授权访问此资源/ api)。 有没有人成功使用它? 如果是这样,你能分享一些代码,技巧或窍门吗?

整合Google网站管理员工具API

我正在研究一个我希望整合Google网站站长工具Api的项目。 我之前已经在这个主题中问了这个问题,但我还没有得到答复。 我已经在互联网上搜索了一些我已经在这里找到的好文档,但文档没有提供下载到API。 我有Google Data SDK,但这不提供网站站长工具API。 SDK已在此处下载,并指出Webmaster Tools API应该可用 任何人都可以告诉我这个API是否仍然可用,在哪里? 哪里可以找到更好/更多的文档呢?

如何在MVC中解析’访问令牌已过期,但我们无法刷新它’

我目前正致力于谷歌Api ,旨在获得一个登录人员的圈子。我已经拥有访问令牌,但问题是每当我尝试运行我的代码时它返回此exception 访问令牌已过期但我们无法刷新它 我该如何解决这个问题? var claimsforUser = await UserManager.GetClaimsAsync(User.Identity.GetUserId()); var access_token = claimsforUser.FirstOrDefault(x => x.Type == “urn:google:accesstoken”).Value; string[] scopes = new string[] {PlusService.Scope.PlusLogin, PlusService.Scope.UserinfoEmail, PlusService.Scope.UserinfoProfile}; var flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer { ClientSecrets = new ClientSecrets { ClientId = “xx-xx.apps.googleusercontent.com”, ClientSecret = “v-xx”, }, Scopes = scopes, DataStore = new FileDataStore(“Store”), }); var token = […]

强制用户使用mvc c中的Google Organization(G Suite)帐户登录

我在我的mvc网站上实施了Google身份validation。 这是我的示例代码 – AuthConfig.cs public static class AuthConfig { private static string GoogleClientId = ConfigurationManager.AppSettings[“GoogleClientId”]; private static string GoogleClientSecret = ConfigurationManager.AppSettings[“GoogleClientSecret”]; public static void RegisterAuth() { GoogleOAuth2Client clientGoog = new GoogleOAuth2Client(GoogleClientId, GoogleClientSecret); IDictionary extraData = new Dictionary(); OpenAuth.AuthenticationClients.Add(“google”, () => clientGoog, extraData); } } Global.asax中 AuthConfig.RegisterAuth(); AccountController.cs public ActionResult RedirectToGoogle() { string provider = “google”; […]

Google Drive Resumable上传无响应

好吧,我在这里不知道为什么这不起作用。 相同的代码仅用于上传元数据,然后用于多部件上传。 我不能恢复上传工作。 上传文件说第1步应返回带有upload_id的200 ok,但是以下行没有返回任何内容。 内容长度为0,没有任何错误响应。 string responseFromServer = reader.ReadToEnd(); 我的代码: FileInfo info = new FileInfo(pFilename); String MimeType = GetMimeType(pFilename).ToString(); string footer = “\r\n”; //Createing the MetaData to send List _postData = new List(); _postData.Add(“{“); _postData.Add(“\”title\”: \”” + info.Name + “\””); _postData.Add(“}”); string postData = string.Join(” “, _postData.ToArray()); byte[] MetaDataByteArray = Encoding.UTF8.GetBytes(postData); // creating the […]

如何在移动应用程序上进行身份validation后在.NET Core服务器上登录用户

我遇到了.NET Core Web API应用程序身份validation的麻烦。 我想:1)在移动应用程序(目前为iOS)上使用Google对用户进行身份validation2)使用此身份validation,使用AspNetCore.Identity和Entity Framework Core在数据库中创建用户记录3)使用相同的身份validation,从.NET Core调用Google Calendar API服务器 到目前为止,我想出了如何实现1和3,但无法绕过2号。 我的理解是,要登录用第三方认证的用户,由于文档的原因,您需要使用SignInManager实例方法ExternalLoginSignInAsync 。 它需要两个参数: 登录提供程序 (应该简单地称为“Google”)和唯一的提供程序密钥 。 我的问题是我找不到任何地方可以找到一个。 以下是我在移动应用上通过Google登录结果收到的所有内容列表: 这是我尝试调用的方法。 // POST api/signup [HttpPost] public async Task Post([FromBody]string authorizationCode, [FromBody]string userId) { var tokenFromAuthorizationCode = await GetGoogleTokens(userId, authorizationCode); var result = await signInManager.ExternalLoginSignInAsync( “Google”, tokenFromAuthorizationCode.IdToken, false); if (result.Succeeded) return true; var externalLoginInfo = new ExternalLoginInfo( […]

Google在c#中映射自动填充文本框

我有一个餐厅交付WINFORM c#应用程序,在用户需要输入地址,以避免人为错误,我们正试图将谷歌地图的自动完成function集成到文本框中。 我用Google搜索了,我所看到的只是用于WINFORM的asp。 我尝试了一个代码但是它的命名空间丢失了,我不确定它是哪一个 使用的命名空间: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Google.Api.Maps ; using GoogleApi.Helpers; inheritance人代码: private void textBox1_TextChanged(object sender, EventArgs e) { var autoCompleteListCollection = new AutoCompleteStringCollection(); autoCompleteListCollection.AddRange(new GoogleApi.Instance.GetAddressPredictionsByInput(textBox1.Text).ToArray()); textBox1.AutoCompleteCustomSource = autoCompleteListCollection; } 错误: 错误1命名空间“GoogleApi”中不存在类型或命名空间名称“Instance”(您是否缺少程序集引用?) 我认为这可能有用。 所以请让我知道正确的命名空间或指导我如何达到上述要求 最后我得到了它的工作,但它崩溃的应用程序,inheritance人的代码: private void textBox1_TextChanged(object […]

使用带有.net framework 3.5的Google Calendar API V3

我正在使用一个使用.Net 3.5框架的Web应用程序。 它使用Google日历API V1。 在谷歌论坛中搜索时,发现Google日历API V1和V2已弃用,应使用V3。 Google Calendar API V3平台支持是.NET Framework 4和4.5 我们的应用程序应该升级到.NET framework 4还是4.5? 或者是否有任何解决方案在.Net 3.5框架中使用谷歌日历API?

Google Cloud Storage InsertMediaUpload Service BaseUri ArgumentNullException

我正在尝试将文件上传到Google云端存储中的存储桶。 我编写了以下代码来创建StorageService并将文件上传到存储桶。 GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer() { ClientSecrets = new ClientSecrets { ClientId = _googleSettings.ClientID, ClientSecret = _googleSettings.ClientSecret }, DataStore = new FileDataStore(System.Web.HttpContext.Current.Server.MapPath(“/App_Data”)), Scopes = new string[] { StorageService.Scope.DevstorageReadWrite }, }); UserCredential userCredentials = new UserCredential(flow, Environment.UserName, new TokenResponse()); StorageService service = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = userCredentials, ApplicationName = “GCS Sample” […]