Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

request_token broken? #30

Closed
rlex opened this Issue Sep 13, 2011 · 7 comments

Comments

Projects
None yet
4 participants

rlex commented Sep 13, 2011

request_token = client.request_token(:oauth_callback => 'YOUR_CALLBACK_URL')

says that i can't have arguments for request_token method

alxx commented Oct 18, 2011

Apparently now request_token does allow parameters, but not very usefully, as any attempt to get a request_token with a callback URL results in 401.

If I don't use the callback argument I can authenticate using PIN, but that's not practical for my web app.

alxx commented Oct 18, 2011

I fixed the 401 issue by setting up a placeholder callback URL in the app settings -- apparently Twitter assumes otherwise it's a desktop app, I found this out by inspecting the actual body of the 401 response -- so now I can grant access rights to my app, but still it works PIN-based (even though I've clearly specified a callback URL in request_token too).

I have the same problem with 401 issue. OAuth::Unauthorized at request_token.

alxx: I new to Ruby and Sinatra. How did you construct your placeholder?

I fixed the 401 issue by setting up a placeholder callback URL in the app settings

alxx commented Oct 29, 2011

Hi Gustaf. By "app settings" I meant the Twitter app settings -- in the Twitter website, where you created your app and you can now edit settings for it.

Just type any valid URL in the callback field. As long as you specify it when you request the token from Ruby, the one in the Twitter app settings will be ignored.

I getting 401 OAuth::Unauthorized at request_token. I have already added a URL in the callback field via Twitter app settings.

  # Error /foo/twitter_output.rb in block in <class:TwitterApp>

  # store the request tokens and send to Twitter
  get '/connect' do
    request_token = @client.request_token(
      :oauth_callback => ENV['CALLBACK_URL'] || @@config['callback_url']
    )

    session[:request_token] = request_token.token
    session[:request_token_secret] = request_token.secret
    redirect request_token.authorize_url.gsub('authorize', 'authenticate') 
  end

alxx commented Oct 30, 2011

No idea why you're replacing 'authorize' with 'authenticate'. It works fine for me with the default authorize_url.

alxx:

No idea why you're replacing 'authorize' with 'authenticate'. It works fine for me with the default authorize_url.

Problem is that request_token is failing before authorize_url.

@moomerman moomerman closed this Oct 12, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment