class OAuth2Client::Grant::DeviceCode

Device Grant @see developers.google.com/accounts/docs/OAuth2ForDevices

Public Instance Methods

get_code(opts={}) click to toggle source

Generate the authorization path using the given parameters .

@param [Hash] query parameters

# File lib/oauth2-client/grant/device.rb, line 14
def get_code(opts={})
  opts[:params] ||= {}
  opts[:params][:client_id] = @client_id
  method = opts.delete(:method) || :post
  make_request(method, @device_path, opts)
end
get_token(code, opts={}) click to toggle source

Retrieve an access token given the specified client.

@param [Hash] params additional params @param [Hash] opts options

# File lib/oauth2-client/grant/device.rb, line 25
def get_token(code, opts={})
  opts[:params] ||= {}
  opts[:params].merge!({
    :code       => code,
    :grant_type => grant_type
  })
  opts[:authenticate] ||= :headers
  method = opts.delete(:method) || :post
  make_request(method, @token_path, opts)
end
grant_type() click to toggle source
# File lib/oauth2-client/grant/device.rb, line 7
def grant_type
  "http://oauth.net/grant_type/device/1.0"
end