Esempio n. 1
0
        // Step 2 - Generate User Credentials
        public IOAuthCredentials GetCredentialsFromVerifierCode(string verifierCode, ITemporaryCredentials temporaryCredentials)
        {
            var callbackParameter = _oAuthWebRequestGenerator.GenerateParameter("oauth_verifier", verifierCode, true, true, false);
            var response          = _twitterRequester.ExecuteQueryWithTemporaryCredentials(Resources.OAuthRequestAccessToken, HttpMethod.POST, temporaryCredentials: temporaryCredentials, headers: new[] { callbackParameter });

            if (response == null)
            {
                return(null);
            }

            Match responseInformation = Regex.Match(response, Resources.OAuthTokenAccessRegex);

            if (responseInformation.Groups["oauth_token"] == null || responseInformation.Groups["oauth_token_secret"] == null)
            {
                return(null);
            }

            var credentials = _credentialsFactory.CreateOAuthCredentials(
                responseInformation.Groups["oauth_token"].Value,
                responseInformation.Groups["oauth_token_secret"].Value,
                temporaryCredentials.ConsumerKey,
                temporaryCredentials.ConsumerSecret);

            return(credentials);
        }
 public static IOAuthCredentials CreateCredentials(string userAccessToken, string userAccessSecret, string consumerKey, string consumerSecret)
 {
     return(_credentialsFactory.CreateOAuthCredentials(userAccessToken, userAccessSecret, consumerKey, consumerSecret));
 }