Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twitter_connect

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter_connect

  • 0.1.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

TwitterConnect

facebook connect style twitter oauth

Demo

http://twitter-connect.heroku.com

Install

sudo gem install twitter-connect

Usage

1 define config/twitter.yml


development:
  consumer_token: 
  consumer_secret: 
  logout_url: 
production:
  consumer_token: 
  consumer_secret: 
  logout_url:

consumer_token and consumer_secret are fetched after you registered a twitter app. logout_url is where the app go to when user logs out or the session expired.

2 define routes


map.twitter_oauth '/twitter_oauth', :controller => 'twitter_connects', :action => 'oauth'
map.twitter_callback '/twitter_callback', :controller => 'twitter_connects', :action => 'callback'
map.twitter_logout '/twitter_logout', :controller => 'twitter_connects', :action => 'logout'

3 add javascript to html header


<%= javascript_include_tag 'twitter_connect' %>

4 add twitter login link on view page


<%= tc_login_button "window.location.reload()" %>

Or:


<%= tc_login_button "window.location.href = '#{tweets_path}'", :class_name => 'twitter_button' %>

tc_login_button has two parameters, first is the callback javascript, second is customized parameter :text or :class_name

5 add twitter logout link on view page


<%= link_to "Logout from Twitter", twitter_logout_path %>

6 get twitter information or post tweet

 
class TwitterConnect < ApplicationController
  include TwitterOauth
  
  def tweet
    oauth = get_oauth
    client = Twitter::Base.new(oauth)
    client.update('test')
  end
end

Copyright (c) 2010 [Richard Huang], released under the MIT license

FAQs

Package last updated on 06 Jul 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc