Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Oauth with Twitter Gem

Oauth twitter gem ruby on rails

  • Please log in to reply
5 replies to this topic

#1 rekha

rekha

    Passenger

  • Members
  • 3 posts

Posted 10 November 2013 - 06:06 AM

Hi,

 

I want to integrate my rails application with twitter and I am using Oauth with Twitter gem and following this screencast "http://teachmetocode...he-twitter-gem/"

 

But I am getting this error:

 

NameError in TwitterController#login

uninitialized constant Twitter::OAuth

 

I tried all the soultion suggested by others like including twitter gem in gemfile , bundle install, restart server etc but I am still getting this error.

Please help me..I am stuck

 

 

Thanks, Rekha

 

 



#2 Jamie

Jamie

    Controller

  • Moderators
  • 114 posts
  • LocationThe UK

Posted 11 November 2013 - 09:33 PM

Well as the errors states it sounds like the Twitter::OAuth class is uninitialized.

 

What version of rails are you using? Since that screencast is from 2010 I'd imagine the Rails you're using now will be more up to date if you're using a default installation of the gems.

 

Do you have your code on GitHub? Or could you post it to CodePen for us to have a look over?


Rails developer based in Newcastle, UK.
Web app owner - Twitter lover

#3 sammy

sammy

    Passenger

  • Members
  • 2 posts

Posted 13 November 2013 - 07:56 PM

It looks like the Twitter::OAuth class no longer exists in this gem - so that'll be the cause of the error. 

 

I'd suggest using the "omniauth-twitter" gem. Ryan Bates also has a very easy to understand tutorial on how to get started!

 

Regarding Twitter specifically - they've recently switched off their API version one access - most of the gems probably haven't been properly upgraded!


  • Jamie likes this

#4 rekha

rekha

    Passenger

  • Members
  • 3 posts

Posted 14 November 2013 - 08:53 AM

Well as the errors states it sounds like the Twitter::OAuth class is uninitialized.

 

What version of rails are you using? Since that screencast is from 2010 I'd imagine the Rails you're using now will be more up to date if you're using a default installation of the gems.

 

Do you have your code on GitHub? Or could you post it to CodePen for us to have a look over?

My rails version is 3.2.13...I didn't push my code on Github yet...but code is same as screencast ..I am doing same



#5 rekha

rekha

    Passenger

  • Members
  • 3 posts

Posted 14 November 2013 - 08:56 AM

It looks like the Twitter::OAuth class no longer exists in this gem - so that'll be the cause of the error. 

 

I'd suggest using the "omniauth-twitter" gem. Ryan Bates also has a very easy to understand tutorial on how to get started!

 

Regarding Twitter specifically - they've recently switched off their API version one access - most of the gems probably haven't been properly upgraded!

I have seen and used that Ryan Bates screencast for twiiter login from rails application..but twitter integration with rails application is not there...it ask to subscribe first..



#6 Kevin

Kevin

    Signalman

  • Members
  • 21 posts

Posted 21 November 2013 - 09:19 AM

are you using it with devise ? mind to show your Gemfile ?

 

I add gem 'omniauth-twitter' to my gemfile, bundle install.

 

Then add this to omniauth.rb (under config/initializers)

provider :twitter, '<your twitter app key>', '<your twitter app token>'

Everything works fine, when I type : localhost:3000/auth/twitter.

 

Please note, I don't use "devise" gem. If you're using it, the way with twitter should be different







Also tagged with one or more of these keywords: Oauth, twitter gem, ruby on rails

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users