google-api-dotnet-client

Google Calendar API v3 - Request time out when deploy on server

时光总嘲笑我的痴心妄想 提交于 2019-12-06 04:37:59
I tried to logged in localhost and everything works properly. The code: public static bool LoginGoogleCalendar(string clientId, string clientSecret, string idGCalendarUser, string calendarServiceScope, string folder) { try { UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync( new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret, }, new[] { calendarServiceScope }, idGCalendarUser, CancellationToken.None, new FileDataStore(folder)).Result; return true; } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return false; } } (I set properly

C# Google Drive API list of files from my personal drive

孤街浪徒 提交于 2019-12-06 04:19:20
I am trying to connect to my own personal Google Drive account and gather a list of file names. What I have done: Installed all the NuGet packages required Added Google Drive to the API Manager in Google Developers Console Setup a Service Account and downloaded a P12 key for authentication Wrote the following code to call the API: string EMAIL = "myprojectname@appspot.gserviceaccount.com"; string[] SCOPES = { DriveService.Scope.Drive }; StringBuilder sb = new StringBuilder(); X509Certificate2 certificate = new X509Certificate2(@"c:\\DriveProject.p12", "notasecret", X509KeyStorageFlags

“policy_enforced” error when exchange oauth2 token for google plus

对着背影说爱祢 提交于 2019-12-06 01:15:39
Our app used to work fine until last Tue. We kept getting "policy_enforced" error while exchange oauth2 token for google plus. The response from google is: Google.Apis.Auth.OAuth2.Responses.TokenResponseException: Error:"policy_enforced", Description:"Access denied by a security policy established by the Google Apps administrator of your organization. Please contact your administrator for further assistance.", Uri:"" We're using google-api-dotnet-client and the code is straight forward enough. var flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer { DataStore =

Validate Google ID Token in a .Net backend server

。_饼干妹妹 提交于 2019-12-05 23:11:48
So, I have a Java-script and a .NET backend. In the Javascript i fetch the Google ID token when the user log in and the I would like to pass this to the backend and: 1) Validate the token 2) Extract the email, username etc. This is explained in documentation for java: https://developers.google.com/identity/sign-in/web/backend-auth The main thing is: GoogleIdToken idToken = verifier.verify(idTokenString); And: String email = payload.getEmail(); So simple in Java! But what to do in .NET? I cannot find the documentation! I found the following thread, but it seems like a quite complicated solution

Google API V3 OAUTH2 Hang - TokenResponse-user Credentials File not created

爷,独闯天下 提交于 2019-12-05 20:53:37
Google API V3 OAUTH2 Problem Report The GoogleWebAuthorizationBroker.AuthorizeAsync code below works fine on my Windows 8.1. When I install on my Windows 7 PC and run the EXE, the AuthorizeAsync is executed, the browser opens and I click through the Select an account page and the This app would like to: page and then see a page for a short time that says Received verification code. Closing... There is no TokenResponse-user file saved in the ..\AppData\Roaming\Google.Apis.Auth folder and my EXE hangs (waits forever). I have tried with both Chrome and Internet Explorer browsers. Works fine on

Google Authentication Process

≯℡__Kan透↙ 提交于 2019-12-05 14:50:57
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<NativeApplicationClient>( provider, (p) => GetAuthorization(provider)); CalendarService service = new

How to append “&login_hint=user@gmail.com” to GoogleWebAuthorizationBroker

北战南征 提交于 2019-12-05 13:22:14
I want to append the login_hint to an authentication request to Google. I'm using the following code: FileDataStore fDS = new FileDataStore(Logger.Folder, true); GoogleClientSecrets clientSecrets = GoogleClientSecrets.Load(stream); credential = GoogleWebAuthorizationBroker.AuthorizeAsync( clientSecrets.Secrets, scopes.ToArray(), username, CancellationToken.None, fDS). Result; var initializer = new Google.Apis.Services.BaseClientService.Initializer(); initializer.HttpClientInitializer = credential; Where do I pass this parameter so the mail address is appended before the browser opens? thanks

Google compute engine .NET API examples/samples/tutorials

孤街醉人 提交于 2019-12-05 13:15:25
I haven't been able to find anything that will clearly explain how to use google compute engine through the .net API (specifically c#). Is there anyone that can point me to anything? P.S. I know about the API reference ( https://developers.google.com/resources/api-libraries/documentation/compute/v1/csharp/latest/annotated.html ) I could not find any detailed tutorial with code samples, but official documentation is available at [1] includes a code sample. There is a tutorial with C# sample specific for Google Drive at [2]. For your reference APIs documentation is available at [3] and the

Method not found: 'Void Google.Apis.Util.Store.FileDataStore..ctor(System.String)'

此生再无相见时 提交于 2019-12-05 11:48:41
I've been stuck at this for days now. I copied the exact codes from google api samples to upload files to Google Drive. Here is the code UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync( new ClientSecrets { ClientId = ClientId, ClientSecret = ClientSecret, }, new[] { DriveService.Scope.Drive, DriveService.Scope.DriveFile }, "user", CancellationToken.None, new FileDataStore("MyStore")).Result; But it would throw an exception at runtime: Method not found: 'Void Google.Apis.Util.Store.FileDataStore..ctor(System.String)'. I already added the necessary Google Api dlls. Or if

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

北慕城南 提交于 2019-12-05 08:33:38
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 configuration (app.UseGoogleAuthentication(ConfigureGooglePlus())) private GoogleOAuth2AuthenticationOptions