Hey John,

So a couple of things i've noticed.

1. You are using https://twitter.com instead of https://api.twitter.com
2. Maybe i'm following your flow incorrectly but it looks like you are
passing the OAuth parameters twice. Once in the URL parameters and
once in the body?
3. You are passing an oauth_token to the request_token endpoint.
Making a request to request_token means you don't have a token already
and want one. So that parameter shouldn't be in that request.

Best,
@themattharris

On Feb 5, 9:10 am, john <john.g...@gmail.com> wrote:
> Matt,
>
> The response is empty, that's what I'm curious about. I've included
> the uri, headers, body and request variables below. This request was
> performed at 2/5/2011 12:06.
>
> Uri =
> 'https://twitter.com/oauth/request_token?
> oauth_nonce=47248509&oauth_timestamp=1296925690&oauth_consumer_key=h3bOaVfT 
> r8I7r2KQCzYCA&oauth_signature_method=HMAC-
> SHA1&oauth_version=1.0&oauth_signature=9fpRZWGZls2kpfUQOZFnvPPTC9s%3D'
>
> Request = {'oauth_nonce': '45640133', 'oauth_timestamp': '1296925356',
> 'oauth_consumer_key': 'h3bOaVfTr8I7r2KQCzYCA',
> 'oauth_signature_method': 'HMAC-SHA1', 'oauth_version': '1.0',
> 'oauth_token': 'Y0kKb5PhvjynbpKhfwF9na6ptznlkreKDheHo4YBmY',
> 'oauth_signature': 'zWwMR/v81XlzoeCpeYWHiMMIrPc='}
>
> Body =
> 'oauth_nonce=45640133&oauth_timestamp=1296925356&oauth_consumer_key=h3bOaVf 
> Tr8I7r2KQCzYCA&oauth_signature_method=HMAC-
> SHA1&oauth_version=1.0&oauth_token=Y0kKb5PhvjynbpKhfwF9na6ptznlkreKDheHo4YB 
> mY&oauth_signature=zWwMR
> %2Fv81XlzoeCpeYWHiMMIrPc%3D'
>
> Headers = {'Content-Type': 'application/x-www-form-urlencoded'}
>
> Thanks,
> John
>
> On Feb 4, 9:40 pm, Matt Harris <mhar...@twitter.com> wrote:
>
>
>
>
>
>
>
> > Hi John,
>
> > That dict object doesn't contain the response body. In the response body we 
> > give an error reason such as 'Invalid signature', or 'timestamp out of 
> > bounds'.
>
> > Best,
> > Matt
>
> > On Feb 4, 2011, at 17:37, john <john.g...@gmail.com> wrote:
>
> > > Hi Matt,
>
> > > Thanks for responding. I've posted the response below (as a python
> > > dict).
>
> > > {'status': '401', 'content-length': '1', 'x-xss-protection': '1;
> > > mode=block', 'x-transaction': 'Sat Feb 05 01:33:54 +0000
> > > 2011-76395-3097', 'set-cookie': 'k=74.128.37.77.1296869634703204;
> > > path=/; expires=Sat, 12-Feb-11 01:33:54 GMT; domain=.twitter.com,
> > > guest_id=129686963484327539; path=/; expires=Mon, 07 Mar 2011 01:33:54
> > > GMT,
> > > _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCBwzdPMtAToHaWQiJWY1OTdhNDQ2Yjg1YzIw
> > > %250AYTVjMmEyNWUyMjM2ZTY1ZGY3IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy
> > > %250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--01f06bea7e9f7559080f47e3b046
> > >  117c40c39212;
> > > domain=.twitter.com; path=/', 'expires': 'Tue, 31 Mar 1981 05:00:00
> > > GMT', 'vary': 'Accept-Encoding', 'x-runtime': '0.00533', 'server':
> > > 'hi', 'x-revision': 'DEV', 'last-modified': 'Sat, 05 Feb 2011 01:33:54
> > > GMT', 'connection': 'close', 'pragma': 'no-cache', 'cache-control':
> > > 'no-cache, no-store, must-revalidate, pre-check=0, post-check=0',
> > > 'date': 'Sat, 05 Feb 2011 01:33:54 GMT', 'x-frame-options':
> > > 'SAMEORIGIN', 'content-type': 'text/html; charset=utf-8'}
>
> > > From what I've read, Twitter's oauth responses lack the error handling
> > > that one would like. Any idea where I should go from here? I found the
> > > section of the library I'm using that creates the UTC timestamp, by
> > > calling time.time(). I would think that Django's timezone property
> > > would set the runtime timezone, however I have not checked that
> > > specifically. Any ideas?
>
> > > Thanks,
> > > John
>
> > > On Feb 4, 4:58 pm, Matt Harris <mhar...@twitter.com> wrote:
> > >> Hi John,
>
> > >> What is the does the body of the error response say? The message will 
> > >> tell you which part of the oauth request failed.
>
> > >> Also be aware that oauth timestamps are in UTC seconds.  
>
> > >> Best,
> > >> @themattharris
>
> > >> On Feb 4, 2011, at 12:45, john <john.g...@gmail.com> wrote:
>
> > >>> I have an application that contains a simple setup using the
> > >>> oauthtwitter library found here.
>
> > >>>http://code.google.com/p/oauth-python-twitter/
>
> > >>> #Example code
> > >>> twitter = app.extras.oauthtwitter.OAuthApi(CONSUMER_KEY,
> > >>> CONSUMER_SECRET)
> > >>> request_token = twitter.getRequestToken()
> > >>> oauth_verifier = request.GET.get('oauth_verifier')
> > >>> access_token = twitter.getAccessToken(request_token, oauth_verifier)
>
> > >>> I'm failing at getting the access token. I have a verifier and am
> > >>> passing that along, like the example in the oauth lib, however am
> > >>> continuing to get (all day now) 401s. My system time is set correctly,
> > >>> as this is in a Django project, and I'm setting it via TIME_ZONE =
> > >>> 'America/Kentucky/Louisville' in my settings.py. Can anyone help?
>
> > >>> Thanks,
> > >>> John
>
> > >>> --
> > >>> Twitter developer documentation and resources:http://dev.twitter.com/doc
> > >>> API updates via Twitter:http://twitter.com/twitterapi
> > >>> Issues/Enhancements 
> > >>> Tracker:http://code.google.com/p/twitter-api/issues/list
> > >>> Change your membership to this 
> > >>> group:http://groups.google.com/group/twitter-development-talk
>
> > > --
> > > Twitter developer documentation and resources:http://dev.twitter.com/doc
> > > API updates via Twitter:http://twitter.com/twitterapi
> > > Issues/Enhancements 
> > > Tracker:http://code.google.com/p/twitter-api/issues/list
> > > Change your membership to this 
> > > group:http://groups.google.com/group/twitter-development-talk

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to