Exemple #1
0
        public void GetToken()
        {
            // TODO the token (and not just the access token) should be kept somewhere to implement refresh token scenario one day
            var tokenProvider = new OAuth2TokenProvider(ConsumerKey, ConsumerSecret);

            _accessToken = tokenProvider.GetClientCredentialsToken().AccessToken;
            Client       = new RestClient(_baseUrl)
            {
                Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(_accessToken, TokenType)
            };
        }
 public OAuth2ClientCredentials(string consumerKey, string consumerSecret, string baseUrl)
 {
     TokenProvider = new OAuth2TokenProvider(consumerKey, consumerSecret);
     BaseUrl       = baseUrl;
     _client       = CreateClient();
 }