Skip to content

tatemae/muck-oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

muck-oauth

This gem wraps oauth and oauth-plugin to make it simple to get tokens for services that muck can interact with various services.

Please note that this gem is no longer being maintained. We are migrating to muck-auth which uses omniauth.

For more documentation see: github.com/pelle/oauth-plugin stakeventures.com/articles/2009/07/21/consuming-oauth-intelligently-in-rails stakeventures.com/articles/2008/02/23/developing-oauth-clients-in-ruby

Installation

Add the following to environment.rb

config.gem "oauth"
config.gem "oauth-plugin"
config.gem "muck-oauth"

Add the following to your user model:

include MuckOauth::Models::MuckUser

Configuration

Add the following to global_config.yml. Be sure to get keys from each service that you want to interact with.

# Oauth
# Twitter api access: http://www.twitter.com/apps 
twitter_oauth_key: ''
twitter_oauth_secret: ''

# Google api access: http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html#register
google_oauth_key: ""
google_oauth_secret: ""

# Yahoo api access: http://developer.yahoo.com/flickr/
yahoo_oauth_key: ""
yahoo_oauth_secret: ""

# Flick api access: http://www.flickr.com/services/apps/create/apply
# flickr_oauth_key: 
# flickr_oauth_secret: 

# Linked In api access: https://www.linkedin.com/secure/developer
# linkedin_oauth_key: ""
# linkedin_oauth_secret: ""
linkedin_oauth_key: ""
linkedin_oauth_secret: ""

# Friendfeed api access: https://friendfeed.com/account/login?next=%2Fapi%2Fregister
# Production
friendfeed_oauth_key: ''
friendfeed_oauth_secret: ''  
# Test
friendfeed_oauth_key: ''
friendfeed_oauth_secret: ''

Usage

Add configuration for services to:

intializers/oauth_consumers.rb

Link to each service like this:

<a href="/oauth_consumers/twitter">Twitter</a>
<a href="/oauth_consumers/google">Google</a>

Each service provides methods that enable communication with the service’s api via popular gems. For example, the twitter service uses the twitter gem and so you can call methods against a user’s twitter account like this:

user.twitter.client.verify_credentials[:screen_name]

Please see each gem’s documentation for more information: Twitter Docs: rdoc.info/projects/jnunemaker/twitter Twitter Examples: github.com/jnunemaker/twitter-app/ i.e.

user.twitter.client

Linked In Docs: github.com/pengwynn/linkedin i.e.

user.linked_in.client

Google Docs: github.com/pelle/portablecontacts i.e.

user.google.portable_contacts

Fire Eagle Docs: fireeagle.rubyforge.org/ i.e.

user.fire_eagle.client

Friend Feed Docs: None yet

Yahoo Docs: None yet

Flickr None yet

Tips and Help

If you get an error like this:

uninitialized constant User::TwitterToken

it means you need to setup your global_config.yml with the values specified above.

Copyright © 2009-2010 Tatemae.com. See LICENSE for details.

About

Oauth for muck

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published