我不确定您的问题出在哪里,但我会尽力提供帮助。这是我测试并为我工作的样本。我是从社区那里得到的。不要忘记将密钥放在 app.config 文件中。
TwitterClientInfo twitterClientInfo = new TwitterClientInfo();
twitterClientInfo.ConsumerKey = ConsumerKey; //Read ConsumerKey out of the app.config
twitterClientInfo.ConsumerSecret = ConsumerSecret; //Read the ConsumerSecret out the app.config
TwitterService twitterService = new TwitterService(twitterClientInfo);
//Now we need the Token and TokenSecret
//Firstly we need the RequestToken and the AuthorisationUrl
OAuthRequestToken requestToken = twitterService.GetRequestToken();
string authUrl = twitterService.GetAuthorizationUri(requestToken).ToString();
//authUrl is just a URL we can open IE and paste it in if we want
Process.Start(authUrl); //Launches a browser that'll go to the AuthUrl.
//Allow the App
//ask for the pin
//string pin = ...
OAuthAccessToken accessToken = twitterService.GetAccessToken(requestToken, pin);
string token = accessToken.Token; //Attach the Debugger and put a break point here
string tokenSecret = accessToken.TokenSecret; //And another Breakpoint here
twitterService.AuthenticateWith(AccessToken, AccessTokenSecret);
希望能帮助到你。祝你好运。