开发者

How to tweet via Rails app

开发者 https://www.devze.com 2023-03-02 13:46 出处:网络
I am using the Twitter gem for a company web app, called \'Foobar\'. I also have a Twitter account called \'Foobar\'. I am trying to tweet onto my Foobar Twitter account from the web app.

I am using the Twitter gem for a company web app, called 'Foobar'. I also have a Twitter account called 'Foobar'. I am trying to tweet onto my Foobar Twitter account from the web app.

From the readme docs:

Twitter.configure do |config|
  config.consumer_key = 'YOUR_CONSUMER_KEY'
  config.consumer_secret = 'YOUR_CONSUMER_SECRET'
  config.oauth_token = 'YOUR_OAUTH_TOKEN'
  config.oauth_token_secret = 'YOUR_OAUTH_TOKEN_SECRET'
end

client = Twitter::Client.new
client.update('Hello, from Twitter Gem!')

I have the consumer_key and consumer_secret. Bu开发者_开发技巧t how do I get the oauth token and oauth token secret?


You have to create a new application as a developer on twitter. You will get your token after you create it. http://dev.twitter.com/apps/new

For more information: http://dev.twitter.com/pages/oauth_faq


You have to create an application in https://dev.twitter.com

  • You have to mention the application name,Description and website if you have any.
  • You will get the consumer_key and consumer_secret.
  • Make sure that you have changed the access level as required to your application.
  • After that click the create access token button in the same page.
  • It will create the access token and access token secret.
  • You should use the access token as oath_token and access token secret as oath_token_secret..
0

精彩评论

暂无评论...
验证码 换一张
取 消