【问题标题】:Linq2Twitter Bad Authentication Data Error 215Linq2Twitter 错误的身份验证数据错误 215
【发布时间】:2013-06-14 14:03:28
【问题描述】:

我收到一个 LinqToTwitter.TwitterQueryException "Bad Authentication Data" with innerException "The remote server returned an error: (400) Bad Request."

我正在使用最新版本的 LinqToTwitter (v2.1.06) 和 Twitter API v1.1。

以下代码用于身份验证:

private XAuthAuthorizer GetAuthorizer()
        {
            var auth = new XAuthAuthorizer
            {
                Credentials = new XAuthCredentials
                {
                    ConsumerKey = CONSUMER_KEY,
                    ConsumerSecret = CONSUMER_SECRET,
                }
            };

            auth.Credentials.AccessToken = ACCESS_TOKEN;
            auth.Credentials.OAuthToken = OAUTH_TOKEN;
            auth.Authorize();
            return auth;
        }

错误发生在下面的foreach循环行:

XAuthAuthorizer _auth = GetAuthorizer();
   _twitter = new TwitterContext(_auth);
var friendTweets = from tweet in _twitter.Status where tweet.Type == StatusType.Show && tweet.ID == tweetID select tweet;

                    foreach (var tweet in friendTweets)
                    {
                        AddTweetToCache(tweetID, tweet);
                        return tweet;
                    }

任何帮助将不胜感激!

【问题讨论】:

    标签: twitter


    【解决方案1】:

    这解决了它。我用的是认证方式。

    var auth = new ApplicationOnlyAuthorizer 
                    { 
                        Credentials = new InMemoryCredentials 
                    { 
                        ConsumerKey = CONSUMER_KEY, 
                        ConsumerSecret = CONSUMER_SECRET 
                    } 
                    };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-22
      • 2015-06-30
      • 2015-09-23
      • 2015-07-10
      • 2019-07-24
      • 2020-11-05
      • 2013-10-05
      • 1970-01-01
      相关资源
      最近更新 更多