2014-03-03 1 views
0

검색 API와 을 사용하여 Linq2Twitter (v. 2)로 작업했습니다. 스트림 API로 전환하고 싶었습니다. 3 절로 업데이트되었지만 그 이후로는 더 이상 인증을 관리하지 못합니다. Stream API 또는 버전이 문제가 될 수 있다고 생각하지 않습니다. 이전 버전의 이전 인증 방법으로 되돌아 가려고했기 때문에 더 이상 작동하지 않습니다. 물론Linq2Twitter - 401 : 잘못된 인증 데이터

 var auth = new SingleUserAuthorizer 
      { 

      CredentialStore = new SingleUserInMemoryCredentialStore() 
      { 
       ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"], 
       ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"], 
       OAuthToken = ConfigurationManager.AppSettings["twitterOAuthToken"], 
       AccessToken = ConfigurationManager.AppSettings["twitterAccessToken"] 
      } 
      }; 

     TwitterContext _twitterCtx = new TwitterContext(auth); 


     try 
     { 
      var verifyResponse = 
       await 
        (from acct in _twitterCtx.Account 
        where acct.Type == AccountType.VerifyCredentials 
        select acct) 
        .SingleOrDefaultAsync(); 

      if (verifyResponse != null && verifyResponse.User != null) 
      { 
       User user = verifyResponse.User; 

       Console.WriteLine(
        "Credentials are good for {0}.", 
        user.ScreenNameResponse); 
      } 
     } 
     catch (TwitterQueryException tqe) 
     { 
      Console.WriteLine(tqe.Message); 
     } 

, 나는 자격 증명을 여러 번 확인을 인쇄하고 모든 : 나는 여기에 내 현재 코드입니다, 그래서 401 : bad authentication data.

를 얻을. ApplicationOnlyAuthorizer, v.2, v.3에서도 시도했지만 아무 것도 변경하지 않았습니다. 내가 가장 무서운 것은 일하는 것이 (v2 + ApplicationOnly + Search API)도 작동하지 않는다는 것입니다.

내 연구를 통해 비동기 타임 스탬프로 인한 문제에 대해 들어 보았습니다. 그러나 나는 그것을 어떻게 바꿀 수 있는지 이해하지 못한다. 프로그램이 서버에 있지 않고 로컬에 저장되어 있습니다.

읽어 주셔서 감사합니다.

답변

3

다음은 버전 3.0에서 SingleUserAuthorizer을 사용하는 방법은 다음과 같습니다 나는 AccessToken과 AccessToken 비밀을 설정하고있어 것을 여기

 var auth = new SingleUserAuthorizer 
     { 
      CredentialStore = new SingleUserInMemoryCredentialStore 
      { 
       ConsumerKey = ConfigurationManager.AppSettings["consumerKey"], 
       ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"], 
       AccessToken = ConfigurationManager.AppSettings["accessToken"], 
       AccessTokenSecret = ConfigurationManager.AppSettings["accessTokenSecret"] 
      } 
     }; 

알 수 있습니다. 또한 401 문제 해결을위한 FAQ와 함께 FAQ를 가지고 있습니다.

https://linqtotwitter.codeplex.com/wikipage?title=LINQ%20to%20Twitter%20FAQ&referringTitle=Documentation