# File lib/oauth2/client.rb, line 120 def get_token(params, access_token_opts={}) opts = {:raise_errors => true, :parse => params.delete(:parse)} if options[:token_method] == :post opts[:body] = params opts[:headers] = {'Content-Type' => 'application/x-www-form-urlencoded'} else opts[:params] = params end response = request(options[:token_method], token_url, opts) raise Error.new(response) unless response.parsed.is_a?(Hash) && response.parsed['access_token'] AccessToken.from_hash(self, response.parsed.merge(access_token_opts)) end