On 8/14/10 7:21 PM, Rajinder Yadav wrote:
> On 10-08-14 09:20 AM, Tom van der Woerdt wrote:
>> On 8/14/10 5:22 AM, Rajinder Yadav wrote:
>>   
>>> On 10-08-13 08:35 PM, Rajinder Yadav wrote:
>>>     
>>>> Hello,
>>>>
>>>> I'm not having success with the following code, I get a "Sorry, page
>>>> doesn't exist!" webpage. I am using the OAuth v0.4.1 gem.  Your help
>>>> and guidance is very appreciated, thanks!
>>>>
>>>> If I type the following out in IRB, it seems to work, but of course I
>>>> can't redirect from the shell.
>>>>
>>>>
>>>> class HomeController<  ApplicationController
>>>>
>>>>    def index
>>>>       @consumer = OAuth::Consumer.new( "bLXXXXXXXXI9szbXTJQnXKA",
>>>>         "XXXXXXXXXXm41S6SYEy9uYR5oiAUxToPvQUlMd6g9A",
>>>>         { :site=>"https://api.twitter.com/oauth/request_token"; } )
>>>>
>>>>        @request_tok...@consumer.get_request_token
>>>>
>>>>        session[:consumer]      = @consumer
>>>>        session[:request_token] = @request_token
>>>>
>>>>        redirect_to @request_token.authorize_url
>>>>    end
>>>>
>>>> end
>>>>
>>>>        
>>> Hi I found by making the following change I now see the allow/deny page.
>>> However when I click on allow, I do not get redirected back to my
>>> callback page?
>>>
>>>
>>> @consumer = OAuth::Consumer.new( "bLXXXXXXXXI9szbXTJQnXKA",
>>>         "XXXXXXXXXXm41S6SYEy9uYR5oiAUxToPvQUlMd6g9A",
>>>         :site=>"https://twitter.com";,
>>>         :request_token_path =>  "/oauth/request_token",
>>>         :authorize_path     =>  "/oauth/authorize",
>>>         :access_token_path  =>  "/oauth/access_token",
>>>         :http_method =>  :get ) )
>>>
>>>
>>> What I am seeing in the pin page, saying:
>>>
>>> You've successfully granted access to XXXX_TestApp!
>>> Simply return to XXXX_TestApp and enter the following PIN to complete
>>> the process.
>>>
>>> How do I get Twitter to return back to my callback page on my site? My
>>> app type is correctly set to "browser".
>>>
>>> -- 
>>>
>>> Kind Regards,
>>> Rajinder Yadav
>>>
>>>      
>> Hi,
>>
>> You should send theoauth_callback  parameter, as specified by the
>> documentation.
>>
>> Tom
>>    
> Hi Tom,
> 
> I have tired sending oauth_callback, made sure that my callback url
> matches exactly the one specified in twitter app setting, something like
> this:
> 
> redirect_to @request_token.authorize_url + "&oauth_callback=" +
> CGI.escape("http://myhome.dnydns.org/callback";)
> 
> I am testing the site from home using dynamic dns setup, would this be
> causing the problem?
> Also in the call to OAuth::Consumer.new, should the http_method be :get
> or :post ?
> I've also changed :site=>"https://twitter.com"; to, :site =>
> "https://api.twitter.com";
> I'm still not sure what I am doing wrong and I feel like I am chasing my
> tail!
> 

Hi Rajinder,

Sorry if you misunderstood my last message. You are supposed to send the
callback in your oauth_callback parameter. If you get the PIN page, then
you send "oob" - out-of-bands, as your oauth_callback.

http://tools.ietf.org/html/rfc5849#section-2.1
Section 2.1 of RFC 5849 (OAuth 1.0) specifies oauth_callback as REQUIRED
- so, you are probably already sending it (either that, or Twitter
doesn't follow the specifications).

Also, it is a part of Section 2.1 of the OAuth specification - the part
where the client talks to the server. The line you changed was Section
2.2 - the redirection part.

Tom

Reply via email to