Method: Android::Publisher::Secrets#to_authorized_connection

Defined in:
lib/android/publisher/secrets.rb

#to_authorized_connectionObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/android/publisher/secrets.rb', line 79

def to_authorized_connection
  # OAuth2::Client.new(
  #   "49761657086.apps.googleusercontent.com", "Cp43nWEtueuPVEKPDJhmr4Mb",
  #   {:site => "https://accounts.android.com/", :authorize_url=>"/o/oauth2/auth", :token_url=>"/o/oauth2/token"}
  # )
  params = {
    :site           =>  URI.join(authorization_uri, '/'),
    :authorize_url  =>  authorization_uri.path,
    :token_url      =>  token_credential_uri.path
  }
  client = OAuth2::Client.new(client_id, client_secret, params)
  token  = OAuth2::AccessToken.new(client, access_token, { :refresh_token => refresh_token })
  token.refresh!
end