class OAuth2Client::Grant::Password

Public Instance Methods

get_token(username, password, opts={}) click to toggle source

Retrieve an access token given the specified client.

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

# File lib/oauth2-client/grant/password.rb, line 15
def get_token(username, password, opts={})
  opts[:params] ||= {}
  opts[:params].merge!({
    :grant_type => grant_type,
    :username   => username,
    :password   => password
  })
  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/password.rb, line 5
def grant_type
  'password'
end