To post on twitter, do I need the omniauth gem (along with the gem)?

I'm using devose and looking to post to twitter using the "twitter" gem, but I'm a little confused, do I need an omnout stone as well? I need to set up omniauth with devise (I use it for users) before I can use the "twitter" gem to allow users to tweet.

EDIT - btw, these are the users who will tweet to their respective twitter accounts

thank

+3


source to share


2 answers


No, you don't need the Omniauth gem, just twitter is enough

This is what I did

Gemfile

gem 'twitter'

      

create your app from this url and make sure you give your app POST permission

config / initializers / twitter.rb

Twitter.configure do |config|
  config.consumer_key = ""
  config.consumer_secret = ""
  config.oauth_token = ""
  config.oauth_token_secret = ""
end

      

then call it like



Twitter.update("I'm tweeting with @gem!")

      

on the side of the note, if you have a url that needs to be shortened use bitly

go to bit and take an access token

Gem File

gem 'bitly'

and call it

bitly = Bitly.new("key", "key")
shorten_url = bitly.shorten("http://skylinelive.com")

      

NTN

+7


source


No, you don't need Omniauth for your users to post tweets. Omniauth is for authentication only - this means that you register with your website and create user accounts.



I could guide you to what you need if you included information on how publishing should work on your website. If all you want is to let them scroll the link to the current page, you need to include the code for the Tweet Button on the desired page.

+2


source







All Articles