Created
October 27, 2011 02:48
-
-
Save mattetti/1318670 to your computer and use it in GitHub Desktop.
google cloud print pointers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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