예제 #1
0
        public static string GetAccessToken(
            IConsumerTokenManager tokenManager, string requestToken, string verifier)
        {
            DesktopConsumer desktopConsumer = new DesktopConsumer(ServiceDescription, tokenManager);

            var accessToken = desktopConsumer.ProcessUserAuthorization(requestToken, verifier);

            return(string.Format("{0}={1}",
                                 accessToken.AccessToken,
                                 tokenManager.GetTokenSecret(accessToken.AccessToken)));
        }
예제 #2
0
        public bool FinishAuthentication()
        {
            using (var twitter = new WebConsumer(ServiceDescription, _tokenManager))
            {
                var accessTokenResponse = twitter.ProcessUserAuthorization();
                if (accessTokenResponse != null)
                {
                    AccessToken = accessTokenResponse.AccessToken;
                    SecretToken = _tokenManager.GetTokenSecret(AccessToken);
                    UserName    = accessTokenResponse.ExtraData["screen_name"];
                    return(true);
                }
            }

            return(false);
        }