google-api-dotnet-client

Google Authentication Process

荒凉一梦 提交于 2019-12-07 08:57:04
问题 I am trying to write a native app to access a users google calendar. I am trying to use the example that google has provided to get authentication but it never seems to fire the authentication function private void Window_Initialized(object sender, EventArgs e) { var provider = new NativeApplicationClient( GoogleAuthenticationServer.Description); provider.ClientIdentifier = "<My Client Id here>"; provider.ClientSecret = "<My Client Secret here"; var auth = new OAuth2Authenticator

How can I use ASP.NET MVC Owin AccessToken in Google.Apis call?

流过昼夜 提交于 2019-12-07 05:09:40
问题 I'm trying to use the AccessToken provided by Owin in Google.Apis requests but I'm receiveing the exception System.InvalidOperationException (Additional information: The access token has expired but we can't refresh it). My configuration of Google Authentication is OK and I can successfully login into my application with it. I store the context.AccessToken as a Claim in the authentication callback (OnAuthenticated "event" of GoogleOAuth2AuthenticationProvider). My Startup.Auth.cs

Authenticating Google Drive using tokens saved in the Database

不打扰是莪最后的温柔 提交于 2019-12-07 03:00:35
I am trying to create my own implementation of IDataStore for use with Google Authentication. I have created the DatabaseDataStore (similar to one found in the sample ) which implements the IDataStore . In my web application I have a register User page where I ask user to click the register button and he gets redirected to the Google authentication. This is the code for that. var result = await new AuthorizationCodeMvcApp(this, new AppFlowMetadata()). AuthorizeAsync(cancellationToken); and this is AppFlowMetadata : private static readonly IAuthorizationCodeFlow flow = new

GoogleCredential created by json private key file (ServiceAccount) - how to set the User to impersonate?

别等时光非礼了梦想. 提交于 2019-12-07 01:45:01
问题 just starting with Google Apis. In my Google Cloud Platform account i created a Service Account for domain wide delegation. I saved a private key file in json format for this service account. In my test application i am creating a GoogleCredential instance: var credential = GoogleCredential.FromStream(new FileStream("privatekey.json", FileMode.Open, FileAccess.Read)) .CreateScoped(Scopes); How can i set the user i want to impersonate? When using a p12 private key i could do the following: var

Why is type of these User properties object: Addresses, Emails, Organizations, etc?

六眼飞鱼酱① 提交于 2019-12-06 14:58:35
问题 I am referring to the Google.Apis.Admin.Directory.directory_v1.Data.User type. The property type of Addresses , for example, in beta versions (i.e. 1.7 and older) was public virtual System.Collections.Generic.IList<UserAddress> Addresses { get; set; } In later versions (currently 1.9.1), they are all of type object. public virtual object Addresses { get; set; } What are the reasons behind the change and usage scenarios? I trawled the release notes, the web, google group, SO, etc. and found no

get Google Credential throws Unhandled Exception

爱⌒轻易说出口 提交于 2019-12-06 13:07:45
On My Xamarin.forms Portable Project, I am trying to read information from google sheet : using (var stream = this.Assets.Open(@"clientsecret.json")) { var secrets = GoogleClientSecrets.Load(stream).Secrets; //I get the secrets correctly credential = GoogleWebAuthorizationBroker.AuthorizeAsync( secrets, Scopes, "user", CancellationToken.None, new FileDataStore(credPath,true)).Result; } I get Unhandled Exception System.AggregateException: One or more errors occurred. when the complier trying to get credential, keep in your mind the same code is working fine in windows forms application You

Google API: Gmail Service Push Notification (Watch) - User not authorized to perform this action

。_饼干妹妹 提交于 2019-12-06 10:52:34
问题 I am trying to call watch() on a mailbox. I set up a service Iam account, and created a topic and suscription. I gave my service account full(owner) rights to my topic and subscription. But when calling execute on watch(), I get the error: Google.Apis.Requests.RequestError Error sending test message to Cloud PubSub projects/projectid/topics/topicname : User not authorized to perform this action. [403] Errors [ Message[Error sending test message to Cloud PubSub projects/projectid/topics

Batch Request - SendAs Emails

时间秒杀一切 提交于 2019-12-06 09:09:29
问题 Is there a way to do a batch request to get SendAs emails from multiple or all users? Currently we are using a service account with user impersonation to go through each user and get the SendAs email list - lot of requests. GmailService as service - this is impersonated as the user. service.Users.Settings.SendAs.List("me").Execute(); P.S. I posted this in google group, but just read a post that said the forum is now read-only! It's weird that it allowed me to make a new post (and obviously i

Google.Apis client for C#sharp auth using refresh token

与世无争的帅哥 提交于 2019-12-06 08:15:36
I'm using new beta Google APIs Client Library for .NET to load tasks lists of more than one user. It's classified as "installed aplication" (according to google dev. console) with more than one authorized user accounts. It's really simple to authenticate one user (using google.apis) but I cannot figure out, how to do the same with refresh tokens, and how to use this tokens to get service object. Sample code: var credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(GoogleTools.GenerateStreamFromString(GoogleTools.Cred)).Secrets, new[] { TasksService.Scope.Tasks },

Google Custom Search API - Engine Retrieving Engine Data Fails

空扰寡人 提交于 2019-12-06 07:19:52
问题 I need to do CRUD on Custom Search Engines. From documentation, it looks pretty straight forward. I keep getting 401 responses though. I am using Google.Apis.Oauth2.v2 to get a token: String serviceAccountEmail = "blahblahblah@developer.gserviceaccount.com"; var certificate = new X509Certificate2(@"key.p12", "blah", X509KeyStorageFlags.Exportable); var credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer(serviceAccountEmail) { Scopes = new[] { "https://www