gpt4 book ai didi

asp.net - 将 Twitter 集成到 Asp.net

转载 作者:行者123 更新时间:2023-12-02 18:15:58 26 4
gpt4 key购买 nike

protected void Page_Load(object sender, EventArgs e)
{
var oauth_consumer_key = "pUw6DN1vh2PRhqIQd0w";
var oauth_consumer_secret = "uCrFLs6x3LlKd6G9YZ2XSzvjiQZmfAM1z3TTEus";

if(Request["oauth_token"] == null)
{
OAuthTokenResponse reqToken = OAuthUtility.GetRequestToken(
oauth_consumer_key,
oauth_consumer_secret,
Request.Url.AbsoluteUri);

Response.Redirect(string.Format("http://twitter.com/oauth/authorize?oauth_token={0}",
reqToken.Token));
}
else
{
string requestToken = Request["oauth_token"].ToString();
string pin = Request["oauth_verifier"].ToString();
var tokens = OAuthUtility.GetAccessToken(
oauth_consumer_key,
oauth_consumer_secret,
requestToken,
pin);
OAuthTokens accesstoken = new OAuthTokens()
{
AccessToken = tokens.Token,
AccessTokenSecret = tokens.TokenSecret,
ConsumerKey = oauth_consumer_key,
ConsumerSecret = oauth_consumer_secret
};

TwitterResponse<TwitterStatus> response = TwitterStatus.Update(
accesstoken,
"Testing!! It works (hopefully).");

if(response.Result == RequestResult.Success)
{
Response.Write("we did it!");
}
else
{
Response.Write("it's all bad.");
}

}
}

我已经将 twitter 集成到了 asp.net 中。但总是给我回应。结果“未知”消息“一切都很糟糕。”我不知道我的结局会发生什么。安装包 twitterizer - 版本 2.4.2引用这个链接 Twitter Integration Link

最佳答案

这是因为访问未经授权。请检查您的响应对象的TwitterStatus

或者,您可以检查一下这个Updated Twitterizer Integration Code .

关于asp.net - 将 Twitter 集成到 Asp.net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23011478/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com