Module: Legato::OAuth2Helpers

Extended by:
OAuth2Helpers
Included in:
OAuth2Helpers
Defined in:
lib/legato/cli.rb

Instance Method Summary collapse

Instance Method Details

#auth_url(client) ⇒ Object



17
18
19
20
21
22
# File 'lib/legato/cli.rb', line 17

def auth_url(client)
  client.auth_code.authorize_url({
    :scope => 'https://www.googleapis.com/auth/analytics.readonly',
    :redirect_uri => 'http://localhost'
  })
end

#build_client(id, secret) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/legato/cli.rb', line 8

def build_client(id, secret)
  opts = {
    :authorize_url => 'https://accounts.google.com/o/oauth2/auth',
    :token_url => 'https://accounts.google.com/o/oauth2/token'
  }

  OAuth2::Client.new(id, secret, opts)
end