Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

fraudpointer/two-legged-oauth-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, "[email protected]")

# 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).

About

Support for Google Apps 2 Legged OAuth in ruby apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages