Example #1
0
 public static async Task<GoogleDrive> CreateInstance(Account account, string id, ClientSecrets secrets, string rootPath,
     string credentialPath, CancellationToken token)
 {
     var ret = new GoogleDrive(account, id, secrets, credentialPath);
     var rootFolder = await ret.GetFolderByPathAsync(rootPath, token, true);
     ret.rootFolder = rootFolder;
     return ret;
 }
Example #2
0
        async public void Authorize()
        {
            var secrets = new ClientSecrets { ClientId = "285737664603-8l6kprl3ahtanud9o8jqb7il4mckiegh.apps.googleusercontent.com", ClientSecret = "xtyxhDwzKRkzDZOHcME3WMtU" };
            var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(secrets, new[] { DriveService.Scope.Drive }, "user", CancellationToken.None);

            var service = new DriveService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = "Bloop Drive Plugin" });

            var files = service.Files.List().Execute();
        }
 public new static async Task<UserCredential> AuthorizeAsync(ClientSecrets clientSecrets,
     IEnumerable<string> scopes, string user, CancellationToken taskCancellationToken,
     IDataStore dataStore = null)
 {
     var initializer = new GoogleAuthorizationCodeFlow.Initializer
     {
         ClientSecrets = clientSecrets,
     };
     return await AuthorizeAsyncCore(initializer, scopes, user, taskCancellationToken, dataStore)
         .ConfigureAwait(false);
 }
        public BloggerManager(string clientId, string clientSec, string appName)
        {
            _csAppSec = new ClientSecrets
            {
                ClientId = clientId,
                ClientSecret = clientSec
            };

            _fdsStore = new FileDataStore(appName);
            _strAppName = appName;
        }
Example #5
0
 public static UserCredential createCredential(ClientSecrets cs, FileDataStore fds)
 {
     UserCredential uc = GoogleWebAuthorizationBroker.AuthorizeAsync(
         cs,
         new[] { BloggerService.Scope.Blogger },
         "user",
         CancellationToken.None,
         fds
         ).Result;
     return uc;
 }
        /// <summary>Asynchronously authorizes the specified user.</summary>
        /// <remarks>
        /// It uses <seealso cref="Google.Apis.Util.Store.StroageDataStore"/> as the flow's data store by default.
        /// </remarks>
        /// <param name="clientSecrets">The client secrets URI.</param>
        /// <param name="scopes">
        /// The scopes which indicate the Google API access your application is requesting.
        /// </param>
        /// <param name="user">The user to authorize.</param>
        /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
        /// <returns>User credential.</returns>
        private static async Task<UserCredential> AuthorizeAsync(ClientSecrets clientSecrets,
            IEnumerable<string> scopes, string user, CancellationToken taskCancellationToken)
        {
            var initializer = new GoogleAuthorizationCodeFlow.Initializer
            {
                ClientSecrets = clientSecrets,
                Scopes = scopes,
                DataStore = new StroageDataStore()
            };

            var installedApp = new AuthorizationCodeWinRTInstalledApp(initializer);
            return await installedApp.AuthorizeAsync(user, taskCancellationToken).ConfigureAwait(false);
        }
        public ActionResult Show(string token, string email, string name)
        {
            UserCredential credential;
            var listOfEvents = new List<EventViewModel>();
            var json = JsonParser();

            ClientSecrets cs = new ClientSecrets()
            {
                ClientId = json["installed"]["client_id"].ToString(),
                ClientSecret = json["installed"]["client_secret"].ToString()
            };

            credential = GoogleWebAuthorizationBroker.AuthorizeAsync(cs, Scopes, "user", CancellationToken.None).Result;

            credential.Token.AccessToken = token;

            // Create Google Calendar API service.
            var service = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = ApplicationName,
            });

            // Define parameters of request.
            EventsResource.ListRequest request = service.Events.List("primary");
            request.TimeMin = DateTime.Now;
            request.ShowDeleted = false;
            request.SingleEvents = true;
            request.MaxResults = 10;
            request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;

            // List events.
            Events events = request.Execute();
            if (events.Items != null && events.Items.Count > 0)
            {
                foreach (var eventItem in events.Items)
                {
                    var eventName = (string.IsNullOrEmpty(eventItem.Summary)) ? "No Title" : eventItem.Summary;
                    var userEvent = new EventViewModel(eventName, eventItem.Start.DateTime, eventItem.End.DateTime);

                    listOfEvents.Add(userEvent);
                }
            }

            ViewData["Events"] = listOfEvents;
            ViewData["Email"] = email;
            ViewData["Name"] = name;

            return View();
        }
        private async Task<GDriveContext> RequireContext(RootName root, string apiKey = null)
        {
            if (root == null)
                throw new ArgumentNullException(nameof(root));

            var result = default(GDriveContext);
            if (!contextCache.TryGetValue(root, out result)) {
                var clientSecret = new ClientSecrets() { ClientId = Secrets.CLIENT_ID, ClientSecret = Secrets.CLIENT_SECRET };
                var credentials = await GoogleWebAuthorizationBroker.AuthorizeAsync(clientSecret, new[] { DriveService.Scope.Drive }, root.UserName, System.Threading.CancellationToken.None);
                var service = new DriveService(new BaseClientService.Initializer() { HttpClientInitializer = credentials, ApplicationName = "GDrvTest" });
                contextCache.Add(root, result = new GDriveContext(service));
            }
            return result;
        }
Example #9
0
 public IConfigurableHttpClientInitializer GetInstalledApplicationCredentials()
 {
     var secrets = new ClientSecrets
     {
         // Replace these values with your own to use Installed
         // Application Credentials.
         // Pass --askForCredentials on the command line.
         // See https://developers.google.com/identity/protocols/OAuth2#installed
         ClientId = "YOUR_CLIENT_ID.apps.googleusercontent.com",
         ClientSecret = "YOUR_CLIENT_SECRET"
     };
     return GoogleWebAuthorizationBroker.AuthorizeAsync(
         secrets, new[] { StorageService.Scope.DevstorageFullControl },
         Environment.UserName, new CancellationTokenSource().Token)
         .Result;
 }
Example #10
0
        public async Task<Stream> method() {
            var clientSecrets = new ClientSecrets {
                ClientId = "1000234763615-sqj7a7rh11vkrqr5p77oplv00lrvki6l.apps.googleusercontent.com",
                ClientSecret = "uPnqOcWiM2cFPaE1UxYCdh4E"
            };
            var scope = new[] { DriveService.Scope.Drive };
            var user = "******";

            var cancellationToken = CancellationToken.None;
            var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(clientSecrets, scope, user, cancellationToken, new FileDataStore("bin"));

            var service = new DriveService(new BaseClientService.Initializer {
                HttpClientInitializer = credential,

            });
            return await service.Files.List().ExecuteAsStreamAsync();
        }
Example #11
0
        private UserCredential CreateCredential()
        {
            ClientSecrets clientSecrets = new ClientSecrets()
            {
                ClientId =  config.GmailClientId, 
                ClientSecret = config.GmailApiClientSecret
            };

            UserCredential credential;

            credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                clientSecrets,
                Scopes,
                config.NotificationAccount,
                CancellationToken.None,
                new EFDataStore()).Result;
            return credential;
        }
Example #12
0
        private void _download_Click(object sender, EventArgs e)
        {
            try
            {
                ClientSecrets cs = new ClientSecrets();
                cs.ClientId = "728822159738-252ghnvc1l1kjssq0d6dtrf2h2t48ihp.apps.googleusercontent.com";
                cs.ClientSecret = "lO67xySyeUClGRYmwQ1LIyee";


                UserCredential uc = GoogleWebAuthorizationBroker.AuthorizeAsync(cs, new string[] { Google.Apis.Coordinate.v1.CoordinateService.Scope.Coordinate }, "user", System.Threading.CancellationToken.None, new FileDataStore("Timelines.MyLibrary")).Result;

                var coordinateService = new CoordinateService(new BaseClientService.Initializer
                {
                    HttpClientInitializer = uc,
                    ApplicationName = "Google maps timeline downloader"
                });


                // ここからどうすんだ?

                /*
                Google.Apis.Http.ConfigurableHttpClient http = coordinateService.HttpClient;

                DateTime target = dateTimePicker1.Value;

                string targetUrl = string.Format("https://www.google.com/maps/timeline/kml?authuser=0&pb=!1m8!1m3!1i{0}!2i{1}!3i{2}!2m3!1i{0}!2i{1}!3i{2}", target.Year, target.Month - 1, target.Day);

                System.Net.Http.HttpResponseMessage res = http.SendAsync(new System.Net.Http.HttpRequestMessage(System.Net.Http.HttpMethod.Get, targetUrl)).Result;

                string result = res.Content.ReadAsStringAsync().Result;

                System.Diagnostics.Debug.Print(result);
                */

            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Print(ex.Message);
                throw;
            }
        }
Example #13
0
        public string Main()
        {
            string result = "";

            CalendarService calendarConnection;

            ClientSecrets secrets = new ClientSecrets
            {
                ClientId = "473177441662-h57ba7mlrtkcgkb15ivd4srfjb4fdps8.apps.googleusercontent.com",
                ClientSecret = "thRD95BupH7H1UZaqoZUHFk3",
            };

            try
            {
                result = "we starting ";
                UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    secrets,
                    new string[]
                    {
                        CalendarService.Scope.Calendar
                    },
                    "user",
                    CancellationToken.None)
                    .Result;

                result = "we pass 1 thing ";

                var initializer = new BaseClientService.Initializer();
                initializer.HttpClientInitializer = credential;
                initializer.ApplicationName = "Jassplan";
                calendarConnection = new CalendarService(initializer);

                result = "we are here after calendar connection";
            }
            catch (Exception ex)
            {
                result = result +  ex.Message;
            }

            return result;
        }
 private static OAuth2Parameters CreateOAuth2Parameters (ClientSecrets clientSecrets, UserCredential credential)
 {
   return new OAuth2Parameters
   {
     ClientId = clientSecrets.ClientId,
     ClientSecret = clientSecrets.ClientSecret,
     AccessToken = credential.Token.AccessToken,
     RefreshToken = credential.Token.RefreshToken
   };
 }
Example #15
0
        public object RefreshOauth()
        {
            var CLIENT_ID = "570313910467-h8raudku9n9n65118tqndopih9breo53.apps.googleusercontent.com";
            var CLIENT_SECRET = "T8vlM82EEb82IAtDSaey-Oet";
            ClientSecrets secrets = new ClientSecrets
            {
                ClientId = CLIENT_ID,
                ClientSecret = CLIENT_SECRET
            };

            TokenResponse token = new TokenResponse
            {
                AccessToken = "sfd",                
                RefreshToken = "1/RcTEm-ZKEtBZzS2jOVLONQcmhtEpRZ7r2zny2HjWtMY"
            };

            IAuthorizationCodeFlow flow =
                new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
                {
                    ClientSecrets = secrets,
                    Scopes = new string[] { DriveService.Scope.Drive }
                });

            UserCredential credential = new UserCredential(flow, "me", token);
            bool success = credential.RefreshTokenAsync(CancellationToken.None).Result;

            token = credential.Token;
            string access = token.AccessToken;

            var dbCtx = new CompassDBEntities();
            var oauthVal = new DriveOauth();
            oauthVal.Id = 1;
            var DriveAuth = dbCtx.DriveOauths.Find(oauthVal.Id);
            
            DriveAuth.AccessToken = token.AccessToken;
            DriveAuth.ExpireTime = token.ExpiresInSeconds.ToString();
            DriveAuth.IssueTime = token.Issued.ToString();
            dbCtx.SaveChanges();
            return token;
        }
Example #16
0
        private async Task CheckGmail()
        {

            UserCredential credential;
            ClientSecrets secrets = new ClientSecrets();
            secrets.ClientId = ClientId;
            secrets.ClientSecret = ClientSecret;
            credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(secrets,
                new[] { GmailService.Scope.GmailReadonly },
                "user", CancellationToken.None);

            var service = new GmailService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Gmail Notifier",
            });

            while (true)
            {
                try
                {
                    var response = service.Users.Labels.Get("me", "INBOX").Execute();
                    if (response.MessagesUnread > 0)
                    {
                        TrayIcon.Icon = GmailNotifier.Properties.Resources.UnreadGmail32;
                        if (response.MessagesUnread == 1)
                        {
                            TrayIcon.Text = "Du har ett oläst meddelande!";
                        }
                        else
                        {
                            TrayIcon.Text = String.Format("Du har {0} olästa meddelanden!", response.MessagesUnread);
                        }
                        TrayIcon.Visible = true;
                        
                        var unreadMessages = service.Users.Messages.List("me");
                        unreadMessages.LabelIds = new[] { "INBOX", "UNREAD" };
                        var inbox = unreadMessages.Execute();

                        foreach (Google.Apis.Gmail.v1.Data.Message message in inbox.Messages)
                        {
                            if (!UnreadMessagesNotifications.ContainsKey(message.Id))
                            {
                                var mess = service.Users.Messages.Get("me", message.Id).Execute();
                                var subject = mess.Payload.Headers.Where(x => x.Name == "Subject").FirstOrDefault();
                                TrayIcon.ShowBalloonTip(3000, subject.Value, mess.Snippet, ToolTipIcon.Info);
                                TrayIcon.Icon = GmailNotifier.Properties.Resources.NewGmail32;
                                UnreadMessagesNotifications.Add(message.Id, message);
                                System.Threading.Thread.Sleep(5000);
                            }
                        }
                        TrayIcon.Icon = GmailNotifier.Properties.Resources.UnreadGmail32;
                    }
                    else
                    {
                        TrayIcon.Icon = GmailNotifier.Properties.Resources.ReadGmail32;
                        TrayIcon.Text = "Inga olästa meddelande!";
                    }
                    System.Threading.Thread.Sleep(500);
                }
                catch (Exception e)
                {
                    Console.WriteLine("An error occurred: " + e.Message);
                }
            }
        }
Example #17
0
        /// <summary>
        /// Logon to Google.
        /// </summary>
        /// <param name="checkAuth">if set to <c>true</c> [check authentication].</param>
        /// <returns></returns>
        private static async Task<SerializableAPIResult<SerializableAPICredentials>> LogOn(bool checkAuth = false)
        {
            SerializableAPIResult<SerializableAPICredentials> result =
                new SerializableAPIResult<SerializableAPICredentials>();

            if (checkAuth && !HasCredentialsStored())
                return result;

            var clientSecrets = new ClientSecrets
            {
                ClientId = Util.Decrypt(GoogleDriveCloudStorageServiceSettings.Default.AppKey,
                    CultureConstants.InvariantCulture.NativeName),
                ClientSecret = Util.Decrypt(GoogleDriveCloudStorageServiceSettings.Default.AppSecret,
                    CultureConstants.InvariantCulture.NativeName)
            };

            try
            {
                s_credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(clientSecrets,
                    new[] { CalendarService.Scope.Calendar }, UserId, CancellationToken.None,
                    new FileDataStore(GetCredentialsPath(checkAuth), true));

                if (checkAuth)
                {
                    using (CalendarService client = await GetClient())
                        await client.Settings.List().ExecuteAsync();
                }
            }
            catch (GoogleApiException exc)
            {
                result.Error = new SerializableAPIError { ErrorMessage = exc.Error.Message };
            }
            catch (TokenResponseException exc)
            {
                result.Error = new SerializableAPIError { ErrorMessage = exc.Error.ErrorDescription ?? exc.Error.Error };
            }
            catch (APIException exc)
            {
                result.Error = new SerializableAPIError { ErrorCode = exc.ErrorCode, ErrorMessage = exc.Message };
            }
            catch (Exception exc)
            {
                result.Error = new SerializableAPIError { ErrorMessage = exc.Message };
            }

            return result;
        }
Example #18
0
        public async Task<HttpResponseMessage> SavePost()
        {
            Posts post;
            if (!Request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }
            string uploadPath = HttpContext.Current.Server.MapPath("~/") + "UploadFiles";
            if (!Directory.Exists(uploadPath))
                Directory.CreateDirectory(uploadPath);
            List<Google.Apis.Drive.v2.Data.File> files = null;
            try
            {
                var provider = new MultipartFormDataStreamProvider(uploadPath);
                var result = await Request.Content.ReadAsMultipartAsync(provider);
                if (result.FormData["model"] == null)
                {
                    throw new HttpResponseException(HttpStatusCode.BadRequest);
                }
                
                //get the files
                foreach (var file in result.FileData)
                {
                    //TODO: Do something with each uploaded file
                }
                ClientSecrets secrets = new ClientSecrets
                {
                    ClientId = Constants.CLIENT_ID,
                    ClientSecret = Constants.CLIENT_SECRET
                };

                var fileDataStore = new FileDataStore(HttpContext.Current.Server.MapPath("~/") + "Resources");

                UserCredential credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                    secrets,
                    new[] { DriveService.Scope.Drive },
                    "*****@*****.**",
                    CancellationToken.None, fileDataStore
                    );

                var service = new DriveService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer = credential,
                    ApplicationName = Constants.APP_USER_AGENT
                });

                string Q = "title = 'TinyMarket_Folder' and mimeType = 'application/vnd.google-apps.folder'";
                IList<Google.Apis.Drive.v2.Data.File> _Files = GoogleApiHelper.GoogleApiHelper.GetFiles(service, Q);
                if (_Files.Count == 0)
                {
                    _Files.Add(GoogleApiHelper.GoogleApiHelper.createDirectory(service, "TinyMarket_Folder",
                        "TinyMarket_Folder", "root"));
                }

                if (_Files.Count != 0 && result.FileData.Count > 0)
                {
                    string directoryId = _Files[0].Id;

                    files = GoogleApiHelper.GoogleApiHelper.UploadFileFromRequest(service, result.FileData, directoryId);
                    var list = service.Files.Get(files[0].Id);
                }


                var model = result.FormData["model"];

                post = JsonConvert.DeserializeObject<Posts>(model);
                postService.Add(post);

            }
            catch (Exception e)
            {
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message);
            }
            finally
            {
                string[] filesToDelete = Directory.GetFiles(uploadPath);
                foreach (string file in filesToDelete)
                {
                    if (File.Exists(file))
                    {
                        GC.Collect();
                        GC.WaitForPendingFinalizers();
                        FileInfo f = new FileInfo(file);
                        f.Delete();
                    }
                }
            }
            
            return Request.CreateResponse(HttpStatusCode.OK);
        }
Example #19
0
        /// <summary>
        /// Asynchronously gets the credentials.
        /// </summary>
        /// <returns></returns>
        private static async Task GetCredentialsAsync()
        {
            var clientSecrets = new ClientSecrets
            {
                ClientId = Util.Decrypt(GoogleDriveCloudStorageServiceSettings.Default.AppKey,
                    CultureConstants.InvariantCulture.NativeName),
                ClientSecret = Util.Decrypt(GoogleDriveCloudStorageServiceSettings.Default.AppSecret,
                    CultureConstants.InvariantCulture.NativeName)
            };

            s_credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(clientSecrets,
                new[] { DriveService.Scope.DriveAppdata }, UserId, CancellationToken.None,
                new FileDataStore(GetCredentialsPath(), true)).ConfigureAwait(false);
        }
        public bool ConnectCalendar()
        {
            var secrets = new ClientSecrets
            {
                ClientId = "945058434822-kg3aivhus8fe562j7a1oar208jokclsl.apps.googleusercontent.com",
                ClientSecret = "i14Tm4YYq2XGXtpyIsk5geAl"
            };

            try
            {
                var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                        secrets,
                        new [] { CalendarService.Scope.Calendar },
                        "user",
                        CancellationToken.None)
                .Result;

                var initializer = new BaseClientService.Initializer
                {
                    HttpClientInitializer = credential,
                    ApplicationName = "Discount Work Schedule"
                };
                CalendarConnection = new CalendarService(initializer);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return false;
            }
            return true;
        }
Example #21
0
 protected GoogleDrive(Account account, string id, ClientSecrets secrets, string credentialPath)
     : base(account, id)
 {
     Secrets = secrets;
     CredentialPath = credentialPath;
 }
        private DriveService Initialize()
        {
            var secrets = new ClientSecrets { ClientId = ClientId, ClientSecret = ClientSecret };
            var scopes = new[] { DriveService.Scope.Drive };

            var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(secrets, scopes, "user", CancellationToken.None).Result;

            // Create the service.
            var initialiser = new BaseClientService.Initializer();
            initialiser.HttpClientInitializer = credential;
            initialiser.ApplicationName = "PhotoGallery";
            var service = new DriveService(initialiser);

            return service;
        }
Example #23
0
        private YouTubeService BuildService()
        {
            ClientSecrets secrets = new ClientSecrets()
            {
                ClientId = CLIENT_ID,
                ClientSecret = CLIENT_SECRET
            };

            var token = new TokenResponse { RefreshToken = REFRESH_TOKEN };
            var credentials = new UserCredential(new GoogleAuthorizationCodeFlow(
                new GoogleAuthorizationCodeFlow.Initializer
                {
                    ClientSecrets = secrets
                }),
                "user",
                token);

            var service = new YouTubeService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credentials,
                ApplicationName = "TestProject"
            });

            //service.HttpClient.Timeout = TimeSpan.FromSeconds(360); // Choose a timeout to your liking
            return service;
        }
        async Task<BigqueryService> CreateServiceAsync(CancellationToken cancellationToken) {
            IConfigurableHttpClientInitializer credential;
            cancellationToken.ThrowIfCancellationRequested();
            if(string.IsNullOrEmpty(PrivateKeyFileName)) {
                var dataStore = new DataStore(OAuthRefreshToken, OAuthAccessToken);

                var clientSecrets = new ClientSecrets {
                    ClientId = OAuthClientId,
                    ClientSecret = OAuthClientSecret
                };

                credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(clientSecrets,
                    new[] { BigqueryService.Scope.Bigquery },
                    "user",
                    cancellationToken,
                    dataStore).ConfigureAwait(false);

                OAuthRefreshToken = dataStore.RefreshToken;
                OAuthAccessToken = dataStore.AccessToken;
            } else {
                X509Certificate2 certificate = new X509Certificate2(PrivateKeyFileName, "notasecret", X509KeyStorageFlags.Exportable);
                credential = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(ServiceAccountEmail) {
                    Scopes = new[] { BigqueryService.Scope.Bigquery }
                }.FromCertificate(certificate));
            }

            return new BigqueryService(new BaseClientService.Initializer {
                HttpClientInitializer = credential,
                ApplicationName = applicationName
            });
        }
 /// <summary>
 /// 로그인 처리를 위한 초기설정을 도와주는 함수
 /// </summary>
 /// <param name="client">Client_id와 Client_Secret이 담겨있는 클래스(구글 드라이브 콘솔에서 발급받은 id와 비밀번호)</param>
 /// <param name="scopes">접근 권한에 대한 주소값들이 들어있는 List</param>
 /// <param name="username">사용자를 구별하기 위한 닉네임</param>
 /// <param name="taskCancellationToken">작업이 취소되지 않아야 함을 나타내는 값 : None으로 표시</param>
 /// <param name="store">저장할 위치 (경로로 표시 : 기본 위치 -> C:\Users\bit-user\AppData\Roaming) </param>
 /// initializer는 클라이언트 id와 클라이언트 시크릿 번호를 설정해준다.
 /// <returns>반환값은 유저의 정보가 담긴 UserCredential 클래스 반환</returns>
 /// 
 public static async Task<UserCredential> LoginAuthorizationCodeFlowAsync(ClientSecrets client, IEnumerable<string> scopes, string username, CancellationToken taskCancellationToken, FileDataStore store)
 {
     var initializer = new GoogleAuthorizationCodeFlow.Initializer
     {
         ClientSecrets = client,
     };
     return await AuthorizeAsyncCore(initializer, scopes, username, taskCancellationToken, store)
         .ConfigureAwait(false);
 }
        /// <summary>Asynchronously authorizes the specified user.</summary>
        /// <remarks>
        /// It uses <seealso cref="Google.Apis.Util.Store.StorageDataStore"/> as the flow's data store by default.
        /// </remarks>
        /// <param name="clientSecrets">The client secrets.</param>
        /// <param name="scopes">
        /// The scopes which indicate the Google API access your application is requesting.
        /// </param>
        /// <param name="user">The user to authorize.</param>
        /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
        /// <returns>User credential.</returns>
        public static async Task<UserCredential> AuthorizeAsync(ClientSecrets clientSecrets,
            IEnumerable<string> scopes, string user, CancellationToken taskCancellationToken)
        {
            var initializer = new GoogleAuthorizationCodeFlow.Initializer
            {
                ClientSecrets = clientSecrets,
            };

            return await AuthorizeAsyncCore(initializer, scopes, user, taskCancellationToken);
        }