class Restforce::Middleware::Authentication
def authenticate!
def authenticate! response = connection.post '/services/oauth2/token' do |req| req.body = encode_www_form(params) end if response.status >= 500 raise Restforce::ServerError, error_message(response) elsif response.status != 200 raise Restforce::AuthenticationError, error_message(response) end @options[:instance_url] = response.body['instance_url'] @options[:oauth_token] = response.body['access_token'] if @options[:authentication_callback] @options[:authentication_callback].call(response.body) end response.body end