Skip to content

Instantly share code, notes, and snippets.

@mattetti
Created October 27, 2011 02:48
Show Gist options
  • Save mattetti/1318670 to your computer and use it in GitHub Desktop.
Save mattetti/1318670 to your computer and use it in GitHub Desktop.
google cloud print pointers
client = OAuth2::Client.new(CLIENT_ID, CLIENT_SECRET,
:authorize_url => "/o/oauth2/auth",
:access_token_url => "/o/oauth2/token",
:site => 'https://accounts.google.com/')
get '/auth' do
url = client.web_server.authorize_url(
:redirect_uri => redirect_uri,
:scope => 'https://www.googleapis.com/auth/cloudprint',
:response_type => "code"
)
redirect url
end
get '/oauth2callback' do
access_token = client.web_server.get_access_token(params[:code], :redirect_uri => redirect_uri)
puts `curl -v -H "X-CloudPrint-Proxy: api-prober" -H "Authorization: OAuth #{access_token.token}" https://www.google.com/cloudprint/search`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment