I'm trying to create an application for myself that connects directly to my calendar ... but I never want to participate in re-authentication. I just want to encode authentication once and do it.
Auth code is as follows:
key = Google::APIClient::PKCS12.load_key(SERVICE_ACCOUNT_PKCS12_FILE_PATH, PASSWORD) asserter = Google::APIClient::JWTAsserter.new( SERVICE_ACCOUNT_EMAIL, 'https://www.googleapis.com/auth/calendar', key) @client = Google::APIClient.new @client.authorization = asserter.authorize
My file is SERVICE_ACCOUNT_...PKCS . is at the root of the directory with my Sinatra app.
I have included the Google Calendar API in my gmail account.
I looked at the authentication method here: https://code.google.com/p/google-api-ruby-client/ (under authorization, which talks about server to server communication)
$ ruby server.rb Faraday: you may want to install system_timer for reliable timeouts /home/me/.rvm/gems/ruby-1.8.7-p371/gems/faraday-0.8.4/lib/faraday/utils.rb:16: warning: already initialized constant KeyMap /home/me/.rvm/gems/ruby-1.8.7-p371/gems/faraday-0.8.4/lib/faraday/utils.rb:177: warning: already initialized constant DEFAULT_SEP W, [2013-01-15T09:52:11.371122
What could be the problem? Why am I getting this error? - especially since I copied the code from the gem site.
UPDATE:
found this:
invalid_grant is trying to get oAuth token from google
says I have to do this: "Make sure you specify access_type = offline in your request.
How can I do this with a ruby ββpearl? without fully repeating HTTP requests?
source share