views:

255

answers:

1

I managed to make the oauth process work for PIN kind of verification. My twitter application is client type. When enter authorize url into web browser and grant the application access then I have to enter pin in my ruby application. Can I finish the process of getting access token without the pin thing?

  • What changes do I need to do to make it work without pin?
  • Could somebody tell me what is the different between client and web application in general? I'd say that it is the same once I get the access token.

My current code is like.

gem 'oauth'
require 'oauth/consumer'

consumer_key = 'your_key'
consumer_secret ='your_secret'

consumer=OAuth::Consumer.new consumer_key, 
                          consumer_secret, 
                          {:site=>"http://twitter.com"}
request_token = consumer.get_request_token

puts request_token.authorize_url
puts "Hit enter when you have completed authorization."
pin = STDIN.readline.chomp 

access_token = request_token.get_access_token(:oauth_verifier => pin)

puts
puts access_token.token
puts access_token.secret
+1  A: 

You cannot skip the PIN (called verifier) step.

That's when the client authorizes your app to access protected resources.

You can save your users the trouble of copying that number and pasting it in your app if you can host a public web application that exposes a URL where the OAuth Provider can redirect you to, with the verifier or PIN as a querystring parameter.

To do this, you should pass that URL in the oauth_callback parameter instead of sending oob

Edit:

You might want to check the relevant part of the specification -> 6.2.3

Pablo Fernandez
does it mean that the pin would be passed in the callback via web?
Radek
that's correct, you'll receive it as a querystring parameter called **verifier**
Pablo Fernandez
can I somehow capture that in my ruby script?
Radek
is you application a web application?
Pablo Fernandez