public void ShouldSuccessfullyRetrieveBearerToken()
        {
            var config = new TestOAuthConfiguration
            {
                Url    = _configuration["OdsApi:OAuthUrl"],
                Key    = _configuration["OdsApi:Key"],
                Secret = _configuration["OdsApi:Secret"]
            };

            Console.WriteLine(config.Url);
            Console.WriteLine($"key:    {config.Key}");
            Console.WriteLine($"secret: {config.Secret}");

            var tokenRetriever = new TokenRetriever(config);
            var tokenHandler   = new OAuthTokenHandler(tokenRetriever);

            var token = tokenHandler.GetBearerToken();

            Console.WriteLine($"token:  {token}");

            Assert.IsTrue(!string.IsNullOrEmpty(token));
        }
Exemple #2
0
        public void ShouldSuccessfullyRetrieveBearerToken()
        {
            var sandboxCredentials = SandboxCredentialsHelper.GetMinimalSandboxCredential();

            var config = new TestOAuthConfiguration
            {
                Url = Settings.Default.OauthUrl, Key = sandboxCredentials.Key, Secret = sandboxCredentials.Secret
            };

            Console.WriteLine(config.Url);
            Console.WriteLine($"key:    {config.Key}");
            Console.WriteLine($"secret: {config.Secret}");

            var tokenRetriever = new TokenRetriever(config);
            var tokenHandler   = new OAuthTokenHandler(tokenRetriever);

            var token = tokenHandler.GetBearerToken();

            Console.WriteLine($"token:  {token}");

            Assert.IsTrue(!string.IsNullOrEmpty(token));
        }