def build_authorize_url(base_url, params)
      uri = URI.parse(base_url.to_s)
      queries = {}
      queries = Hash[URI.decode_www_form(uri.query)] if uri.query
      # TODO doesn't handle array values correctly
      queries.merge!(params) if params
      uri.query = URI.encode_www_form(queries) if !queries.empty?
      uri.to_s
    end
def build_authorize_url(base_url, params)
      uri = URI.parse(base_url.to_s)
      queries = {}
      queries = Hash[URI.decode_www_form(uri.query)] if uri.query
      # TODO doesn't handle array values correctly
      queries.merge!(params) if params
      uri.query = URI.encode_www_form(queries) if !queries.empty?
      uri.to_s
    end
construct an authorization url