Exemple #1
0
        private void InitializeGoogleConsumer()
        {
            this.googleTokenManager.ConsumerKey    = ConfigurationManager.AppSettings["googleConsumerKey"];
            this.googleTokenManager.ConsumerSecret = ConfigurationManager.AppSettings["googleConsumerSecret"];

            string pfxFile = ConfigurationManager.AppSettings["googleConsumerCertificateFile"];

            if (string.IsNullOrEmpty(pfxFile))
            {
                this.google = new DesktopConsumer(GoogleConsumer.ServiceDescription, this.googleTokenManager);
            }
            else
            {
                string pfxPassword        = ConfigurationManager.AppSettings["googleConsumerCertificatePassword"];
                var    signingCertificate = new X509Certificate2(pfxFile, pfxPassword);
                var    service            = GoogleConsumer.CreateRsaSha1ServiceDescription(signingCertificate);
                this.google = new DesktopConsumer(service, this.googleTokenManager);
            }
        }