Repository is archived
No release in over 3 years
Low commit activity in last 3 years
Extends the normal oauth gem to support Google's custom two legged OAuth (2LO) mechanism, needed for interacting with the Google Apps APIs through the Google Apps Marketplace.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0

Runtime

~> 0.4.0
 Project Readme

Two Legged OAuth

Description

The purpose of this gem is to make the oauth gem play nice with Google's custom 2 legged OAuth (2LO), used specifically for Google Apps APIs accessed from Google Apps Marketplace applications.

For more info on the 2 legged OAuth see these :

This gem has been tested with the following libraries so far and seems to be working ok :

Installation

Bundler

Add on your Gemfile :

gem 'two-legged-oauth'

By hand

On the console :

gem install two-legged-oauth

On your code :

require 'two-legged-oauth'

Usage

# Create a normal consumer instance
oauth_consumer = OAuth::Consumer.new("key", "secret")

# Initialize a TwoLeggedAccessToken specifying the xoauth_requestor_id
access_token = OAuth::TwoLeggedAccessToken.new(oauth_consumer, "user@domain.com")

# Pass that access token to Google Data libraries (or your custom scripts)
gs = GoogleSpreadsheet.login_with_oauth(access_token)

Internals

This thing works by rewriting the requested URL on-the-fly and appends the xoauth_requestor_id param appropriately. This may be dangerous at times so be aware that some well hidden bugs may come up...

Bugs/fixes

Report any issues on the github's issue tracker or send a pull request if you have nailed the bug.

Contributing

Tested contributions are always welcome! Here's what you should do:

  1. Clone the repo
  2. Run the tests
  3. Write some test-driven code
  4. Create a pull request

License

two-legged-oauth is copyright 2011 by Fraudpointer, released under the MIT License (see LICENSE for details).