2009-09-03 19 views
5

私はhttp://code.google.com/p/oauth-python-twitterを使用して、appengine(python)に "twitter oauth"を実装しようとしています。401 oauth-python-twitterを使用して無許可

私がツイッターにユーザーをリダイレクトするには、次のコードを使用し

twitter = OAuthApi(CONSUMER_KEY, CONSUMER_SECRET) 
request_token = twitter.getRequestToken() 
response.set_cookie('request_token', request_token.to_string()) 
signin_url = twitter.getAuthorizationURL(request_token) 
return redirect_to(signin_url) 

ユーザーが正常にリダイレクトされますが、彼は自分のアプリケーションに戻ったときに、私は、次のエラーが表示さ: HTTPエラー401:許可されていない

File "/base/data/home/apps/app/controllers/users.py", line 46, in authenticate 
    access_token = twitter.getAccessToken()  
    File "/base/data/home/apps/app/lib/python/oauthtwitter.py", line 183, in getAccessToken 
    token = self._FetchUrl(url, no_cache=True) 
    ...... 
    File "/base/python_dist/lib/python2.5/urllib2.py", line 506, in http_error_default 
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) 

アクセストークンを取得しようとするとエラーが発生します。

request_token = request.cookies['request_token'] 
token = oauth.OAuthToken.from_string(request_token) 
twitter = OAuthApi(app_globals.CONSUMER_KEY, app_globals.CONSUMER_SECRET, token) # everything works good 
access_token = twitter.getAccessToken() # then, i receive the error. 

ありがとうございました!

答えて

0

あなたの/あなたのTwitterアカウントのTwitter認証セクションにあなたのアプリケーション名が入力されていることを確認して、アプリケーションに接続許可が与えられていることを確認してください。

2

私はoauth-python-twitterとpython-twitterのトランクバージョンを使用して問題を解決しました。

関連する問題