google-api-ruby-client/lib/google/api_client/auth
Jeff Posnick fb67a021e7 Added Google::APIClient::FileStorage, to save OAuth 2 credentials to disk
This is a (potentially rough) bit of code to persist OAuth 2
credentials to disk, similar to
http://google-api-python-client.googlecode.com/hg/docs/epy/oauth2client.
file.Storage-class.html

It can be used in the following manner, which roughly translates to
what the Python client library code looks like.

  file_storage = Google::APIClient::FileStorage.new("#{$0}-oauth2.json")
  if file_storage.authorization.nil?
    client_secrets = Google::APIClient::ClientSecrets.load
    flow = Google::APIClient::InstalledAppFlow.new(
      :client_id => client_secrets.client_id,
      :client_secret => client_secrets.client_secret,
      :scope => [SCOPE1, SCOPE2]
    )
    client.authorization = flow.authorize(file_storage)
  else
    client.authorization = file_storage.authorization
  end
2013-05-29 15:31:44 -04:00
..
file_storage.rb Added Google::APIClient::FileStorage, to save OAuth 2 credentials to disk 2013-05-29 15:31:44 -04:00
installed_app.rb Added Google::APIClient::FileStorage, to save OAuth 2 credentials to disk 2013-05-29 15:31:44 -04:00
jwt_asserter.rb fix for #22 impersonation 2013-01-12 10:29:47 -05:00
key_utils.rb Read keyfile in binary mode 2013-01-02 12:59:43 -08:00
pkcs12.rb Refactor key loading to support PEM + fix issue #62 2012-11-02 13:56:53 -07:00