2014-03-04 20 views
2

我正在使用TweetSharp Api,並且我有一些關於service.GetRequestToken()的問題。TweetSharp GetRequestToken該頁面的請求令牌無效

這裏是我的代碼: -

TwitterService service = new TwitterService("######", "######"); 
OAuthRequestToken requestToken = service.GetRequestToken(); 
Uri uri = service.GetAuthorizationUri(requestToken); 
     Process.Start(uri.ToString()); 

的問題是,當我重定向到Twitter的授權窗口來這樣的信息: -

Whoa there! 
The request token for this page is invalid. It may have already been used, or expired because it is too old. Please go back to the site or application that sent you here and try again; it was probably just a mistake. 

URI是這樣的:

https://api.twitter.com/oauth/authorize?oauth_token=? 

有幫助嗎?

在此先感謝。

回答

0

您是否已在apps.twitter.com正確註冊您的應用程序?您的代碼可以正常使用我的消費者密鑰和TweetSharp 2.3.1。

+0

是的,我確定我做到了。 – user2728312

+0

好的。你是否在應用程序設置中提供了回調URL?當我不提供這些信息時,我能夠重現您的問題。有可能與此[線程]重複(http://stackoverflow.com/questions/6333864/tweetsharp-authorization-renders-no-oauth-token?rq=1) –

+0

我檢查了我的回調網址,我寫了正確的回調網址然後解決了我的問題。謝謝@MiKaDo_O – daylight

0

您可以嘗試的另一件事是重新生成API密鑰並使用它們。他們也提供這個選項

'它可能已經被使用,或過期,因爲它太舊了。'

+0

我試過了,但不起作用 – user2728312

1

我面臨着同樣的問題,我解決了問題,只是取消選中在Twitter的應用程序設置以下行

啓用回撥鎖定(建議啓用回調鎖定 ,以確保應用程序無法覆蓋的回調URL)

此複選框是回調URL文本框下的應用程序設置選項卡

我不知道爲什麼Twitter團隊推薦它,如果它爲一些人制造麻煩。如果有人知道推薦的原因,請讓我們知道。謝謝

相關問題