avm_69
avm_69

Reputation: 183

Oauth Unauthorized Ruby

I'm having trouble configuring my Twitter Oauth in a RubyonRails webapp.

The full trace error: http://pastebin.com/2yf1cE8E

The User.rb http://pastebin.com/UUTiTKvy

The app controller http://pastebin.com/bK9ghUJR

The session controller http://pastebin.com/kxYRd1TU

The routes.rb http://pastebin.com/bt7HMRFy

Omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, 'JsR9zFGrVuDYuFueRnBQK9tpp', '   tDubF5v9uDRvfio7UBZd2XlFYUQQrftE7Qzk6FPaNOucOTWVlf'
end

Thanks, Alex.

Upvotes: 0

Views: 175

Answers (2)

Mohamed Said Benmousa
Mohamed Said Benmousa

Reputation: 499

Looking at the error, I think you did not define the callback url of Twitter. You have to go into twitter applications and define the URL of your webapp in your callback.

Upvotes: 2

Jocko
Jocko

Reputation: 537

Looking at the error and the code you provided, you're not properly authenticating to Twitter. The 401 response is basically telling you that Twitter doesn't like the identity information you're passing in. So I would verify your keys are correct, and that OmniAuth doesn't require any additional configurations (e.g. specific endpoints Your second key in the Omniauth middleware code appears to have additional spaces in it, you may have done that for security purposes, but I'm pretty sure that keys shouldn't start with spaces.

IMPORTANT NOTE: Once you've confirmed a fix, you should request new keys for your Twitter account, as they have been posted publicly to this forum.

Upvotes: 0

Related Questions