Hi Avinash, First, it's most appropriate to use a POST on the request token and access token steps of the OAuth flow (though GET will work fine).
You might be having your issues because you are sending the oauth_token as part of your request in the request token step. The request token step of OAuth is essentially a "two-legged" operation, without a "user authorized" element (which the oauth_token and oauth_token_secret comprise). You shouldn't be sending either a key or value for oauth_token at this stage, and your "composite signing key" in this step would simply be your consumer secret and the ampersand, properly escaped. You should also limit sending the oauth_callback to ONLY the request_token step -- its existence at any other step is invalid. Taylor Singletary Developer Advocate, Twitter http://twitter.com/episod On Tue, Jun 8, 2010 at 6:57 AM, avinash <[email protected]> wrote: > Hi Taylor, > Thanks for the pointers you wrote in the previous post. I had a > recheck in my program flow based on your pointers. > I send the callback url during signing of the request itself(GET > request). I have added its as default parameter in my header all the > time. > Here's how it looks: > > {'oauth_version': '1.0', 'oauth_token': 'xxxxxxxxxxxxxxx', > 'oauth_nonce': 'qwqwqe4234werwr', 'oauth_timestamp': '1276004627', > 'oauth_signature': 'xxxxxxxxxxxxI=', 'oauth_consumer_key': > 'xxxxxxxxxxxxxxx', 'oauth_signature_method': 'HMAC-SHA1', > 'oauth_callback': 'http://10.1.1.112:8000/register/authenticated/ > aswq34ertyu1dfg'} > > After this I get this as the response(after authorization from twitter > end), > > {'oauth_version': '1.0', 'oauth_token': '"1.0" encoding', > 'oauth_nonce': '30495529', 'oauth_timestamp': '1276004628', > 'oauth_signature': 'xxxxxxxxxxxx=', 'oauth_consumer_key': > 'xxxxxxxxxx', 'oauth_signature_method': xxxxxxxxx', 'oauth_callback': > 'http://10.1.1.112:8000/register/authenticated/aswq34ertyu1dfg'} > > As you can see in 'oauth_token' key, the value is incorrect it should > have been the oauth token of the authorized user. > > Could you still further throw some light as to what exactly wrong is > going on. It'll be of great help if you could give some more pointers > as I'm not at all able to figure it where am I missing the link. > > On Jun 7, 7:32 pm, Taylor Singletary <[email protected]> > wrote: > > Hi Avinash, > > > > In OAuth 1.0a, you specify your callback URL on the request token step, > and > > you specify it just like the other OAuth parameters in that request. If > > you're using HTTP-header-based OAuth, that means the callback URL should > be > > in your signature base string and Authorization header. If you're using > > query-string-based OAuth or using the POST body to send OAuth parameters, > > then the oauth_callback should be in both the parameters as well as the > > signature base string. > > > > By specifying your callback URL in the request token step, you should > also > > get back a parameter in the response indicating that it was recognized > > "oauth_callback_confirmed" > > > > Taylor Singletary > > Developer Advocate, Twitterhttp://twitter.com/episod > > > > On Sat, Jun 5, 2010 at 12:24 AM, avinash <[email protected]> wrote: > > > Hi, > > > I'm using the oayth2 python binding from > > >http://github.com/simplegeo/python-oauth2. > > > 1. I perform a request for obtaining 'Request token' I send the > > > following parameters: > > > {'oauth_consumer_key': xxxxx, > > > 'oauth_timestamp': xxxxx, > > > 'oauth_nonce': xxxx, > > > 'oauth_version': x} > > > > > Also I sign in the request with HMAC signature base string > > > This yields me oauth request token and oauth request secret. > > > > > 2. Now using this I send the user fro authorization by calling the > > > url: > > >http://twitter.com/oauth/authenticate?oauth_token=xxxxxxxx > > > > > 3. Once the user is authorized, he/she is redirected to a callback url > > > that I have specified in my app setting while registration. It is this > > > callback url that I want to override. > > > > > When should this overriding take place?Should I place the parameter > > > oauth_callback from the very beginning of the request(while requesting > > > Request Token) or once the user is authorized? > > > > > I tried to put the parameter 'oauth_callback' as a default parameter > > > in my request header. It worked fine till authorization but once once > > > authorization succeeded I could not obtain correct access token and > > > access token request for that authorized user. What I get is this: > > > > > {oauth_nonce: xxxx, oauth_timestamp:xxxxx, oauth_token: xxxxxxx, > > > oauth_token_secret: HMAC-1, oauth_verify:xxxxxx,} > > > Note: The oauth_token is incorrect as I know the correctb token for > > > that user is something else. > > > > > But while I do not try to override the oauth_callback url everything > > > is working smoothly(I obtain the correct oauth token and secret for > > > that user) > > > > > As far as the url is concerned its just my local machine's ip that > > > I've provided in my callback url(app settings),http://10.1.1.112 > > > ;8000/register/authenticated/ > > > and I tried to override it withhttp://10.1.1.112 > > > ;8000/register/authenticated/?q=xxxxxxxxx > > > > > Please suggest where am I going wrong?Or are there any steps that I'm > > > not following?Please highlight them if any. > > > > > Avinash > > > > > On Jun 4, 6:52 pm, Taylor Singletary <[email protected]> > > > wrote: > > > > Could you share some of the steps of your request while setting your > > > > oauth_callback? > > > > > > * Signature Base String > > > > * Your Authorization header > > > > * Any POST body you are sending > > > > * The exact URL you are executing > > > > > > What happens when you complete the authorization step? What > specifically > > > > does not happen? > > > > > > Taylor Singletary > > > > Developer Advocate, Twitterhttp://twitter.com/episod > > > > > > On Fri, Jun 4, 2010 at 6:08 AM, avinash <[email protected]> > wrote: > > > > > Hi, > > > > > I'm working on a web app(interacts with twitter) which uses an > oauth > > > > > protocol for user authorisation. I had registered my app at twitter > > > > > with a specified callback url. But while I make an request I > override > > > > > it by binding oauth_callback parameter in my request header. It > works > > > > > fine till user authorization is concerned but I'm not able to > obtain > > > > > the authenticated user's access token. > > > > > > > But however if I do not override the callback url everything works > > > > > fine. > > > > > > > Please could you suggest where am I going on?Highlight some > pointers > > > > > so that I could resolve the issue. > > > > > > > Avinash >
