【发布时间】:2011-09-11 11:40:11
【问题描述】:
我正在使用Tweetsharp,我正在尝试使用 Twitter 应用程序。目前它是一个简单的控制台应用程序。
我在网上搜索了一些文章,其中大部分都说在2010年8月16日之后,推特的基本身份验证不再适用。相反,OAuth 已经到位。
从此,我去了Twitter Apps并为我创建了一个。(因为它是一个桌面应用程序,所以我选择应用程序类型为客户端而不是浏览器。)
这些是我得到的各种信息
Consumer key : NxDgjunKLu65CW38Ea1RT
Consumer secret :JOomsRGPTHct9hFjGQOTpxScZwI5K8zkIpOC1ytfo
Request token URL : https://twitter.com/oauth/request_token
Access token URL : https://twitter.com/oauth/access_token
Authorize URL: https://twitter.com/oauth/authorize
计划的一个非常基本的步骤是,我将在我的墙上写/发布一些推文。
从今以后,我做了以下(一些代码取自web,因为我将它们用作参考)
string consumerKey = "NxDgjunKLu65CW38Ea1RT";
string consumerSecret = "JOomsRGPTHct9hFjGQOTpxScZwI5K8zkIpOC1ytfo";
FluentTwitter.SetClientInfo(new TwitterClientInfo { ConsumerKey = consumerKey, ConsumerSecret = consumerSecret });
//Gets the token
var RequestToken = FluentTwitter.CreateRequest().Authentication.GetRequestToken().Request().AsToken();
var twitter = FluentTwitter.CreateRequest()
.AuthenticateWith(
consumerKey
,consumerSecret,
RequestToken.Token,
RequestToken.TokenSecret)
.Statuses().Update("I am writing my first tweets").AsXml();
var response = twitter.Request();
var status = response.AsStatus();
但反应是
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<error>Could not authenticate with OAuth.</error>
<request>/1/statuses/update.xml</request>
</hash>
我尝试了很长时间来理解这个问题,但都是徒劳的。
我需要帮助。
谢谢
【问题讨论】:
-
你真的不应该发布你的消费者秘密!
标签: c#-3.0 twitter-oauth