public ITwitterCredentials Resolve()
        {
            var credentials = new TwitterCredentials(
                config.GetEnvironmentVariable("TW_CONSUMER_KEY")?.Trim(),
                config.GetEnvironmentVariable("TW_CONSUMER_SECRET")?.Trim());

            if (string.IsNullOrEmpty(credentials.ConsumerKey) ||
                string.IsNullOrEmpty(credentials.ConsumerSecret))
            {
                log.LogError("Failed to read credentials. [{0}] [{1}]",
                             credentials.ConsumerKey,
                             credentials.ConsumerSecret);
                throw new Exception("Failed to read credentials");
            }

            return(credentials);
        }
        public async Task <bool> Authenticate(CancellationToken token)
        {
            logger.LogInformation("Authenticating");
            var email = configuration.GetEnvironmentVariable("ALPHA_EMAIL");

            email = System.Web.HttpUtility.UrlEncode(email);
            var pass = configuration.GetEnvironmentVariable("ALPHA_PASS");

            pass = System.Web.HttpUtility.UrlEncode(pass);
            logger.LogInformation("Using {0} login", email);
            var loginData = $"user%5Bemail%5D={email}&user%5Bpassword%5D={pass}&id=headtabs_login&activity=footer_login&function=onLoginSuccess";

            reader.ResetCookies();
            await reader.Post(new Uri("https://seekingalpha.com/authentication/login"), loginData, token, Constants.Ajax).ConfigureAwait(false);

            return(true);
        }
        public Credentials(IApplicationConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            QuandlKey = configuration.GetEnvironmentVariable("QUANDL_KEY");
        }