Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Twitter Oauth registration and authentication
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README
routes.rb
sessions_controller.rb
twitter_oauth.rb

README

This is a simple attempt Twitter validation and registration using OAuth.

In your Sessions controller, use

TwitterOauth.get_authentication_url(session)

to get the OAuth redirect URL.

Then, in a '/callback' route, 

access_token = TwitterOauth.get_access_token(session)
screen_name  = TwitterOauth.get_screen_name(access_token)

Will give you the screen name of the Twitter user who has just successfully logged in.
The variable screen_name will be false if the user has not logged in successfully.

Then, use 

  user = User.find_or_create_by_screen_name(screen_name)
  user.token  = access_token.token
  user.secret = access_token.secret

To save the user's token and secret.
Something went wrong with that request. Please try again.