google-api-dotnet-client

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

北战南征 提交于 2019-12-05 05:42:40
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 credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer("xxx@developer

GoogleWebAuthorizationBroker not found

我的未来我决定 提交于 2019-12-05 00:14:30
问题 im learning C# (to develop for windows phone), and im trying to authenticate my user into Google's account. Im using this code: https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#wp var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read), new[] { DriveService.Scope.Drive }, "user", CancellationToken.None); But, i dont know why, i can't use 'GoogleWebAuthorizationBroker'. I already installed

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

醉酒当歌 提交于 2019-12-04 21:33:01
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 explanation on this. A change to the backend had the unintended consequence of changing the

OAuth 2 Google API refresh token is null

自作多情 提交于 2019-12-04 14:10:43
问题 I am developing an Asp.NET MVC5 App following this Google sample code. I want the app to be authenticated and create an accesstoken (Configure stage) by a user and later on I need to be able to call Google APis' (Directory API in my case) using a refresh token (without user intervention, something like "offline"). Controller: public async Task<ActionResult> IndexAsync(CancellationToken cancellationToken) { var result = await new AuthorizationCodeMvcApp(this, new AppFlowMetadata()).

Google Calendar API Authentication .NET browser window

随声附和 提交于 2019-12-04 13:41:29
I am using the latest version of the Google .NET Client API (v1.81). I am trying to connect to the Calendar Service using the following code var calendarService = new CalendarService(new BaseClientService.Initializer { HttpClientInitializer = GetCredential(), ApplicationName = "MyApp" }); public UserCredential GetCredential() { UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync( new ClientSecrets { ClientId = _clientId, ClientSecret = _clientSecret }, new[] { CalendarService.Scope.Calendar }.ToList(), "user", CancellationToken.None, new FileDataStore("Drive.Auth.Store"))

How to pass an Access Token from .NET (code behind) to Javascript

对着背影说爱祢 提交于 2019-12-04 06:18:21
问题 I would like to "authorize" via the .NET framework using my own API keys, secret and Refresh Token, and then pass the Access Token to JavaScript so I can upload a video directly to YouTube with a progress indicator. I have working code via the .NET API that will accomplish the upload directly to my channel [without authorization], but you get no progress indication (and it can take quite some time) and the file must be uploaded to my server first, then to YouTube server. Is a server side

How to make CalendarService object using access_token?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 05:36:10
I am trying to use google calendar v3 api using .net client. I am follwing a hybrid approach. I have authorized my application using oauth2 using only http post request and I get the access_token. But as .net client of calendar v3 api, I need to make a calendarservice reference. I need to find any way to get that service reference using my token. Have a look at this code snippet: Event event = new Event() { Summary = "Appointment", }; Event recurringEvent = service.Events.Insert(event, "primary").Fetch(); // here "service" is authenticate calendarservice instance. Console.WriteLine

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

牧云@^-^@ 提交于 2019-12-04 02:04:06
问题 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

OAuth 2 Google API refresh token is null

谁都会走 提交于 2019-12-03 20:17:12
I am developing an Asp.NET MVC5 App following this Google sample code . I want the app to be authenticated and create an accesstoken (Configure stage) by a user and later on I need to be able to call Google APis' (Directory API in my case) using a refresh token (without user intervention, something like "offline"). Controller: public async Task<ActionResult> IndexAsync(CancellationToken cancellationToken) { var result = await new AuthorizationCodeMvcApp(this, new AppFlowMetadata()). AuthorizeAsync(cancellationToken); if (result.Credential != null) { var service = new Google.Apis.Admin

GoogleWebAuthorizationBroker not found

醉酒当歌 提交于 2019-12-03 16:14:36
im learning C# (to develop for windows phone), and im trying to authenticate my user into Google's account. Im using this code: https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#wp var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read), new[] { DriveService.Scope.Drive }, "user", CancellationToken.None); But, i dont know why, i can't use 'GoogleWebAuthorizationBroker'. I already installed all the references, and im using all the imports. When i run my program, i got these two messages: 'The