@@timestamp = nil
def generate_oauth_url
@@timestamp = timestamp
url = CONNECT_URL + REQUEST_TOKEN_PATH + "&oauth_callback=#{OAUTH_CALLBACK}&oauth_consumer_key=#{OAUTH_CONSUMER_KEY}&oauth_nonce=#{NONCE} &oauth_signature_method=#{OAUTH_SIGNATURE_METHOD}&oauth_timestamp=#{@@timestamp}&oauth_version=#{OAUTH_VERSION}"
puts url
url
end
def sign(url)
Base64.encode64(HMAC::SHA1.digest((NONCE + url), OAUTH_CONSUMER_SECRET)).strip
end
def get_request_token
url = generate_oauth_url
signed_url = sign(url)
request = Net::HTTP.new((CONNECT_URL + REQUEST_TOKEN_PATH),80)
puts request.inspect
headers = { "Authorization" => "Authorization: OAuth oauth_nonce = #{NONCE}, oauth_callback = #{OAUTH_CALLBACK}, oauth_signature_meth od = #{OAUTH_SIGNATURE_METHOD}, oauth_timestamp=#{@@timestamp}, oauth_consumer_key = #{OAUTH_CONSUMER_KEY}, oauth_signature = #{signed_url}, oauth_versio n = #{OAUTH_VERSION}" }
request.post(url, nil,headers)
end
def timestamp
Time.now.to_i
end
que estoy tratando de hacer lo que hace oauth en un intento de comprender cómo utilizar los encabezados de autorización. También recibo el siguiente error. Estoy intentando conectarme a la API de linkedin.neta/http.rb: 560: en `inicializar ': getaddrinfo: Nombre o servicio no conocida (SocketError)
/usr/lib/ruby/1.8/net/http.rb:560:in 'initialize': getaddrinfo: Name or service not known (SocketError)
Realmente apreciaría si alguien me podría empujar en la dirección correcta.
que estoy recibiendo este error de mi servidor cuando intento usar Git con GitLab. El mensaje sale en mi terminal a través de ssh. El error estuvo allí hace dos días, y ahora ya no está. Tal vez mi host linode estaba experimentando problemas DNS? – trusktr
Esto funcionó, giré mi 'wifi' y encendí' on' y listo está listo – illusionist