Skip to content

Instantly share code, notes, and snippets.

@hoanga
Created January 27, 2010 04:32
Show Gist options
  • Save hoanga/287535 to your computer and use it in GitHub Desktop.
Save hoanga/287535 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'gdata'
require 'sinatra'
def is_gapp_user?(user, password)
client = GData::Client::GMail.new
begin
token = client.clientlogin(user, password)
return token
rescue GData::Client::AuthorizationError
return false
end
end
use Rack::Auth::Basic do |username, password|
is_gapp_user?(username, password)
end
get '/' do
"Hello"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment