Generating oauth_signature for Netflix

I am trying to create an oauth signature for use with Netflix. I follow their API documentation, but I have problems when they get to the line that says: " If you use the library as soon as you have created your base line, it is easy to generate a signature. You pass your base line and your shared secret to a function and get a signature. See the OAuth code page for examples . "

I can create my base line and have my shared secret, but I can’t figure out how to use Oauth gem to create a signature.

Any help would be great.

+4
source share
3 answers

In the end, I created the Oauth signature manually instead of using gem:

plain_url = "#{NETFLIX_PUBLIC_URL}"+"#{NETFLIX_TOKEN_ACCESS}" latest_time = "#{Time.now.to_i}" nonce = rand(1_000_000) token_string="oauth_consumer_key=#{NETFLIX_KEY}&oauth_nonce=#{nonce}&oauth_signature_method=HMAC-SHA1&oauth_timestamp=#{latest_time}" + "&oauth_token=#{oauth_token}&oauth_version=1.0" encoded_string = CGI.escape(token_string) encoded_url = CGI.escape(plain_url) signature_string= "GET&"+encoded_url+"&"+encoded_string puts "signature string is " + signature_string signature_key = "#{NETFLIX_SECRET}&#{token_secret}" signature = Base64.encode64(HMAC::SHA1.digest( signature_key,signature_string)).chomp.gsub(/\n/,'') encoded_signature = CGI.escape(signature) call = plain_url + "?" + token_string + "&oauth_signature="+encoded_signature 
+2
source

Have you considered the omniauth strategy for tips? https://github.com/spagalloco/omniauth-netflix/blob/master/lib/omniauth/strategies/netflix.rb - the beauty of open source.

0
source

You mean this:

 OAuth::Signature.signature_base_string(request, options = {}, &block) 

http://www.rubydoc.info/gems/oauth/0.4.7/OAuth/Signature

0
source

All Articles