Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using Google.Apis.Auth.OAuth2;
- using Google.Apis.Auth.OAuth2.Flows;
- using Google.Apis.Keep.v1;
- using Google.Apis.Oauth2.v2;
- using Google.Apis.Services;
- namespace Testing
- {
- class Program
- {
- [Obsolete]
- static void Main(string[] args)
- {
- Console.WriteLine("Google API Sample");
- Console.WriteLine("====================");
- Console.WriteLine(Oauth2Service.Scope.UserinfoEmail);
- Console.WriteLine(KeepService.Scope.KeepReadonly);
- List<string> scopes = new()
- {
- "email",
- "profile",
- KeepService.Scope.Keep,
- KeepService.Scope.KeepReadonly,
- };
- var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets
- {
- ClientId = "",
- ClientSecret = ""
- },
- scopes,
- "user",
- CancellationToken.None).Result;
- var service = new KeepService(new BaseClientService.Initializer()
- {
- HttpClientInitializer = credential,
- ApplicationName = "OAuth 2.0 Sample",
- });
- var notes = service.Notes.List().Execute();
- Console.WriteLine(notes.Notes.Count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement